• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# HOW TO WRITE CONDITIONALS IN THIS FILE
6# ======================================
7#
8# In many other places, one would write a conditional that expresses all the
9# cases when a source file is used or unused, and then either add or subtract
10# it from the sources list in that case
11#
12# Since base includes so many low-level things that vary widely and
13# unpredictably for the various build types, we prefer a slightly different
14# style. Instead, there are big per-platform blocks of inclusions and
15# exclusions. If a given file has an inclusion or exclusion rule that applies
16# for multiple conditions, perfer to duplicate it in both lists. This makes it
17# a bit easier to see which files apply in which cases rather than having a
18# huge sequence of random-looking conditionals.
19
20import("//build/buildflag_header.gni")
21import("//build/config/compiler/compiler.gni")
22import("//build/config/nacl/config.gni")
23import("//build/config/ui.gni")
24import("//build/nocompile.gni")
25import("//testing/test.gni")
26
27if (is_android) {
28  import("//build/config/android/rules.gni")
29}
30
31config("base_flags") {
32  if (is_clang) {
33    cflags = [
34      # Don't die on dtoa code that uses a char as an array index.
35      # This is required solely for base/third_party/dmg_fp/dtoa_wrapper.cc.
36      "-Wno-char-subscripts",
37    ]
38  }
39}
40
41config("base_implementation") {
42  defines = [ "BASE_IMPLEMENTATION" ]
43}
44
45if (is_win) {
46  # This is in a separate config so the flags can be applied to dependents.
47  # ldflags in GN aren't automatically inherited.
48  config("base_win_linker_flags") {
49    ldflags = [
50      "/DELAYLOAD:cfgmgr32.dll",
51      "/DELAYLOAD:powrprof.dll",
52      "/DELAYLOAD:setupapi.dll",
53    ]
54  }
55}
56
57if (is_nacl_nonsfi) {
58  # Must be in a config because of how GN orders flags (otherwise -Wall will
59  # appear after this, and turn it back on).
60  config("nacl_nonsfi_warnings") {
61    # file_util_posix.cc contains a function which is not
62    # being used by nacl_helper_nonsfi.
63    cflags = [ "-Wno-unused-function" ]
64  }
65}
66
67if (is_nacl) {
68  # None of the files apply to nacl, and we can't make an empty static library.
69  group("base_paths") {
70  }
71} else {
72  static_library("base_paths") {
73    sources = [
74      "base_paths.cc",
75      "base_paths.h",
76      "base_paths_android.cc",
77      "base_paths_android.h",
78      "base_paths_mac.h",
79      "base_paths_mac.mm",
80      "base_paths_posix.cc",
81      "base_paths_posix.h",
82      "base_paths_win.cc",
83      "base_paths_win.h",
84    ]
85
86    if (is_android || is_mac || is_ios) {
87      sources -= [ "base_paths_posix.cc" ]
88    }
89
90    configs += [ ":base_implementation" ]
91
92    visibility = [ ":base" ]
93  }
94}
95
96config("android_system_libs") {
97  libs = [ "log" ]  # Used by logging.cc.
98}
99
100# Base and everything it depends on should be a static library rather than
101# a source set. Base is more of a "library" in the classic sense in that many
102# small parts of it are used in many different contexts. This combined with a
103# few static initializers floating around means that dead code stripping
104# still leaves a lot of code behind that isn't always used. For example, this
105# saves more than 40K for a smaller target like chrome_elf.
106#
107# Use static libraries for the helper stuff as well like //base/debug since
108# those things refer back to base code, which will force base compilation units
109# to be linked in where they wouldn't have otherwise. This does not include
110# test code (test support and anything in the test directory) which should use
111# source_set as is recommended for GN targets).
112component("base") {
113  # TODO(phosek) bug 570839: If field_trial.cc is in a static library,
114  # hacl_helper_nonsfi doesn't link properly on Linux in debug builds. The
115  # reasons for this seem to involve obscure toolchain bugs. This should be
116  # fixed and this target should always be a static_library in the
117  # non-component case.
118  component_never_use_source_set = !is_nacl_nonsfi
119
120  sources = [
121    "allocator/allocator_check.cc",
122    "allocator/allocator_check.h",
123    "allocator/allocator_extension.cc",
124    "allocator/allocator_extension.h",
125    "android/animation_frame_time_histogram.cc",
126    "android/animation_frame_time_histogram.h",
127    "android/apk_assets.cc",
128    "android/apk_assets.h",
129    "android/application_status_listener.cc",
130    "android/application_status_listener.h",
131    "android/base_jni_onload.cc",
132    "android/base_jni_onload.h",
133    "android/base_jni_registrar.cc",
134    "android/base_jni_registrar.h",
135    "android/build_info.cc",
136    "android/build_info.h",
137    "android/command_line_android.cc",
138    "android/command_line_android.h",
139    "android/content_uri_utils.cc",
140    "android/content_uri_utils.h",
141    "android/context_utils.cc",
142    "android/context_utils.h",
143    "android/cpu_features.cc",
144    "android/cxa_demangle_stub.cc",
145    "android/event_log.cc",
146    "android/event_log.h",
147    "android/field_trial_list.cc",
148    "android/field_trial_list.h",
149    "android/fifo_utils.cc",
150    "android/fifo_utils.h",
151    "android/important_file_writer_android.cc",
152    "android/important_file_writer_android.h",
153    "android/java_handler_thread.cc",
154    "android/java_handler_thread.h",
155    "android/java_runtime.cc",
156    "android/java_runtime.h",
157    "android/jni_android.cc",
158    "android/jni_android.h",
159    "android/jni_array.cc",
160    "android/jni_array.h",
161    "android/jni_registrar.cc",
162    "android/jni_registrar.h",
163    "android/jni_string.cc",
164    "android/jni_string.h",
165    "android/jni_utils.cc",
166    "android/jni_utils.h",
167    "android/jni_weak_ref.cc",
168    "android/jni_weak_ref.h",
169    "android/library_loader/library_load_from_apk_status_codes.h",
170    "android/library_loader/library_loader_hooks.cc",
171    "android/library_loader/library_loader_hooks.h",
172    "android/library_loader/library_prefetcher.cc",
173    "android/library_loader/library_prefetcher.h",
174    "android/locale_utils.cc",
175    "android/locale_utils.h",
176    "android/memory_pressure_listener_android.cc",
177    "android/memory_pressure_listener_android.h",
178    "android/path_service_android.cc",
179    "android/path_service_android.h",
180    "android/path_utils.cc",
181    "android/path_utils.h",
182    "android/record_histogram.cc",
183    "android/record_histogram.h",
184    "android/record_user_action.cc",
185    "android/record_user_action.h",
186    "android/scoped_java_ref.cc",
187    "android/scoped_java_ref.h",
188    "android/sys_utils.cc",
189    "android/sys_utils.h",
190    "android/thread_utils.h",
191    "android/trace_event_binding.cc",
192    "android/trace_event_binding.h",
193    "at_exit.cc",
194    "at_exit.h",
195    "atomic_ref_count.h",
196    "atomic_sequence_num.h",
197    "atomicops.h",
198    "atomicops_internals_portable.h",
199    "atomicops_internals_x86_msvc.h",
200    "auto_reset.h",
201    "barrier_closure.cc",
202    "barrier_closure.h",
203    "base64.cc",
204    "base64.h",
205    "base64url.cc",
206    "base64url.h",
207    "base_export.h",
208    "base_switches.h",
209    "big_endian.cc",
210    "big_endian.h",
211    "bind.h",
212    "bind_helpers.cc",
213    "bind_helpers.h",
214    "bind_internal.h",
215    "bind_internal_win.h",
216    "bit_cast.h",
217    "bits.h",
218    "build_time.cc",
219    "build_time.h",
220    "callback.h",
221    "callback_helpers.cc",
222    "callback_helpers.h",
223    "callback_internal.cc",
224    "callback_internal.h",
225    "cancelable_callback.h",
226    "command_line.cc",
227    "command_line.h",
228    "compiler_specific.h",
229    "containers/adapters.h",
230    "containers/hash_tables.h",
231    "containers/linked_list.h",
232    "containers/mru_cache.h",
233    "containers/scoped_ptr_hash_map.h",
234    "containers/small_map.h",
235    "containers/stack_container.h",
236    "cpu.cc",
237    "cpu.h",
238    "critical_closure.h",
239    "critical_closure_internal_ios.mm",
240    "debug/alias.cc",
241    "debug/alias.h",
242    "debug/asan_invalid_access.cc",
243    "debug/asan_invalid_access.h",
244    "debug/close_handle_hook_win.cc",
245    "debug/close_handle_hook_win.h",
246    "debug/crash_logging.cc",
247    "debug/crash_logging.h",
248    "debug/debugger.cc",
249    "debug/debugger.h",
250    "debug/debugger_posix.cc",
251    "debug/debugger_win.cc",
252    "debug/dump_without_crashing.cc",
253    "debug/dump_without_crashing.h",
254    "debug/gdi_debug_util_win.cc",
255    "debug/gdi_debug_util_win.h",
256
257    # This file depends on files from the "debug/allocator" target,
258    # but this target does not depend on "debug/allocator" (see
259    # allocator.gyp for details).
260    "debug/leak_annotations.h",
261    "debug/leak_tracker.h",
262    "debug/proc_maps_linux.cc",
263    "debug/proc_maps_linux.h",
264    "debug/profiler.cc",
265    "debug/profiler.h",
266    "debug/stack_trace.cc",
267    "debug/stack_trace.h",
268    "debug/stack_trace_android.cc",
269    "debug/stack_trace_posix.cc",
270    "debug/stack_trace_win.cc",
271    "debug/task_annotator.cc",
272    "debug/task_annotator.h",
273    "deferred_sequenced_task_runner.cc",
274    "deferred_sequenced_task_runner.h",
275    "environment.cc",
276    "environment.h",
277    "feature_list.cc",
278    "feature_list.h",
279    "file_descriptor_posix.h",
280    "file_version_info.h",
281    "file_version_info_mac.h",
282    "file_version_info_mac.mm",
283    "file_version_info_win.cc",
284    "file_version_info_win.h",
285    "files/dir_reader_fallback.h",
286    "files/dir_reader_linux.h",
287    "files/dir_reader_posix.h",
288    "files/file.cc",
289    "files/file_enumerator.cc",
290    "files/file_enumerator.h",
291    "files/file_enumerator_posix.cc",
292    "files/file_enumerator_win.cc",
293    "files/file_path.cc",
294    "files/file_path.h",
295    "files/file_path_constants.cc",
296    "files/file_path_watcher.cc",
297    "files/file_path_watcher.h",
298    "files/file_path_watcher_fsevents.cc",
299    "files/file_path_watcher_fsevents.h",
300    "files/file_path_watcher_kqueue.cc",
301    "files/file_path_watcher_kqueue.h",
302    "files/file_path_watcher_linux.cc",
303    "files/file_path_watcher_mac.cc",
304    "files/file_path_watcher_win.cc",
305    "files/file_posix.cc",
306    "files/file_proxy.cc",
307    "files/file_proxy.h",
308    "files/file_tracing.cc",
309    "files/file_tracing.h",
310    "files/file_util.cc",
311    "files/file_util.h",
312    "files/file_util_android.cc",
313    "files/file_util_linux.cc",
314    "files/file_util_mac.mm",
315    "files/file_util_posix.cc",
316    "files/file_util_proxy.cc",
317    "files/file_util_proxy.h",
318    "files/file_util_win.cc",
319    "files/file_win.cc",
320    "files/important_file_writer.cc",
321    "files/important_file_writer.h",
322    "files/memory_mapped_file.cc",
323    "files/memory_mapped_file.h",
324    "files/memory_mapped_file_posix.cc",
325    "files/memory_mapped_file_win.cc",
326    "files/scoped_file.cc",
327    "files/scoped_file.h",
328    "files/scoped_temp_dir.cc",
329    "files/scoped_temp_dir.h",
330    "format_macros.h",
331    "gtest_prod_util.h",
332    "guid.cc",
333    "guid.h",
334    "guid_posix.cc",
335    "guid_win.cc",
336    "hash.cc",
337    "hash.h",
338    "id_map.h",
339    "ios/crb_protocol_observers.h",
340    "ios/crb_protocol_observers.mm",
341    "ios/device_util.h",
342    "ios/device_util.mm",
343    "ios/ios_util.h",
344    "ios/ios_util.mm",
345    "ios/ns_error_util.h",
346    "ios/ns_error_util.mm",
347    "ios/scoped_critical_action.h",
348    "ios/scoped_critical_action.mm",
349    "ios/weak_nsobject.h",
350    "ios/weak_nsobject.mm",
351    "json/json_file_value_serializer.cc",
352    "json/json_file_value_serializer.h",
353    "json/json_parser.cc",
354    "json/json_parser.h",
355    "json/json_reader.cc",
356    "json/json_reader.h",
357    "json/json_string_value_serializer.cc",
358    "json/json_string_value_serializer.h",
359    "json/json_value_converter.cc",
360    "json/json_value_converter.h",
361    "json/json_writer.cc",
362    "json/json_writer.h",
363    "json/string_escape.cc",
364    "json/string_escape.h",
365    "lazy_instance.cc",
366    "lazy_instance.h",
367    "linux_util.cc",
368    "linux_util.h",
369    "location.cc",
370    "location.h",
371    "logging.cc",
372    "logging.h",
373    "logging_win.cc",
374    "logging_win.h",
375    "mac/authorization_util.h",
376    "mac/authorization_util.mm",
377    "mac/bind_objc_block.h",
378    "mac/bundle_locations.h",
379    "mac/bundle_locations.mm",
380    "mac/call_with_eh_frame.cc",
381    "mac/call_with_eh_frame.h",
382    "mac/call_with_eh_frame_asm.S",
383    "mac/cocoa_protocols.h",
384    "mac/dispatch_source_mach.cc",
385    "mac/dispatch_source_mach.h",
386    "mac/foundation_util.h",
387    "mac/foundation_util.mm",
388    "mac/launch_services_util.cc",
389    "mac/launch_services_util.h",
390    "mac/launchd.cc",
391    "mac/launchd.h",
392    "mac/libdispatch_task_runner.cc",
393    "mac/libdispatch_task_runner.h",
394    "mac/mac_logging.cc",
395    "mac/mac_logging.h",
396    "mac/mac_util.h",
397    "mac/mac_util.mm",
398    "mac/mach_logging.cc",
399    "mac/mach_logging.h",
400    "mac/objc_property_releaser.h",
401    "mac/objc_property_releaser.mm",
402    "mac/os_crash_dumps.cc",
403    "mac/os_crash_dumps.h",
404    "mac/scoped_aedesc.h",
405    "mac/scoped_authorizationref.h",
406    "mac/scoped_block.h",
407    "mac/scoped_cftyperef.h",
408    "mac/scoped_ioobject.h",
409    "mac/scoped_ioplugininterface.h",
410    "mac/scoped_launch_data.h",
411    "mac/scoped_mach_port.cc",
412    "mac/scoped_mach_port.h",
413    "mac/scoped_mach_vm.cc",
414    "mac/scoped_mach_vm.h",
415    "mac/scoped_nsautorelease_pool.h",
416    "mac/scoped_nsautorelease_pool.mm",
417    "mac/scoped_nsobject.h",
418    "mac/scoped_objc_class_swizzler.h",
419    "mac/scoped_objc_class_swizzler.mm",
420    "mac/scoped_sending_event.h",
421    "mac/scoped_sending_event.mm",
422    "mac/sdk_forward_declarations.h",
423    "mac/sdk_forward_declarations.mm",
424    "macros.h",
425    "md5.cc",
426    "md5.h",
427    "memory/aligned_memory.cc",
428    "memory/aligned_memory.h",
429    "memory/discardable_memory.cc",
430    "memory/discardable_memory.h",
431    "memory/discardable_memory_allocator.cc",
432    "memory/discardable_memory_allocator.h",
433    "memory/discardable_shared_memory.cc",
434    "memory/discardable_shared_memory.h",
435    "memory/linked_ptr.h",
436    "memory/manual_constructor.h",
437    "memory/memory_pressure_listener.cc",
438    "memory/memory_pressure_listener.h",
439    "memory/memory_pressure_monitor.cc",
440    "memory/memory_pressure_monitor.h",
441    "memory/memory_pressure_monitor_chromeos.cc",
442    "memory/memory_pressure_monitor_chromeos.h",
443    "memory/memory_pressure_monitor_mac.cc",
444    "memory/memory_pressure_monitor_mac.h",
445    "memory/memory_pressure_monitor_win.cc",
446    "memory/memory_pressure_monitor_win.h",
447    "memory/ptr_util.h",
448    "memory/raw_scoped_refptr_mismatch_checker.h",
449    "memory/ref_counted.cc",
450    "memory/ref_counted.h",
451    "memory/ref_counted_delete_on_message_loop.h",
452    "memory/ref_counted_memory.cc",
453    "memory/ref_counted_memory.h",
454    "memory/scoped_policy.h",
455    "memory/scoped_ptr.h",
456    "memory/scoped_vector.h",
457    "memory/shared_memory.h",
458    "memory/shared_memory_android.cc",
459    "memory/shared_memory_handle.h",
460    "memory/shared_memory_handle_mac.cc",
461    "memory/shared_memory_handle_win.cc",
462    "memory/shared_memory_mac.cc",
463    "memory/shared_memory_nacl.cc",
464    "memory/shared_memory_posix.cc",
465    "memory/shared_memory_win.cc",
466    "memory/singleton.cc",
467    "memory/singleton.h",
468    "memory/weak_ptr.cc",
469    "memory/weak_ptr.h",
470    "message_loop/incoming_task_queue.cc",
471    "message_loop/incoming_task_queue.h",
472    "message_loop/message_loop.cc",
473    "message_loop/message_loop.h",
474    "message_loop/message_loop_task_runner.cc",
475    "message_loop/message_loop_task_runner.h",
476    "message_loop/message_pump.cc",
477    "message_loop/message_pump.h",
478    "message_loop/message_pump_android.cc",
479    "message_loop/message_pump_android.h",
480    "message_loop/message_pump_default.cc",
481    "message_loop/message_pump_default.h",
482    "message_loop/message_pump_glib.cc",
483    "message_loop/message_pump_glib.h",
484    "message_loop/message_pump_io_ios.cc",
485    "message_loop/message_pump_io_ios.h",
486    "message_loop/message_pump_libevent.cc",
487    "message_loop/message_pump_libevent.h",
488    "message_loop/message_pump_mac.h",
489    "message_loop/message_pump_mac.mm",
490    "message_loop/message_pump_win.cc",
491    "message_loop/message_pump_win.h",
492    "metrics/bucket_ranges.cc",
493    "metrics/bucket_ranges.h",
494    "metrics/field_trial.cc",
495    "metrics/field_trial.h",
496    "metrics/histogram.cc",
497    "metrics/histogram.h",
498    "metrics/histogram_base.cc",
499    "metrics/histogram_base.h",
500    "metrics/histogram_delta_serialization.cc",
501    "metrics/histogram_delta_serialization.h",
502    "metrics/histogram_flattener.h",
503    "metrics/histogram_macros.h",
504    "metrics/histogram_samples.cc",
505    "metrics/histogram_samples.h",
506    "metrics/histogram_snapshot_manager.cc",
507    "metrics/histogram_snapshot_manager.h",
508    "metrics/metrics_hashes.cc",
509    "metrics/metrics_hashes.h",
510    "metrics/sample_map.cc",
511    "metrics/sample_map.h",
512    "metrics/sample_vector.cc",
513    "metrics/sample_vector.h",
514    "metrics/sparse_histogram.cc",
515    "metrics/sparse_histogram.h",
516    "metrics/statistics_recorder.cc",
517    "metrics/statistics_recorder.h",
518    "metrics/user_metrics.cc",
519    "metrics/user_metrics.h",
520    "metrics/user_metrics_action.h",
521    "move.h",
522    "native_library.h",
523    "native_library_ios.mm",
524    "native_library_mac.mm",
525    "native_library_posix.cc",
526    "native_library_win.cc",
527    "nix/mime_util_xdg.cc",
528    "nix/mime_util_xdg.h",
529    "nix/xdg_util.cc",
530    "nix/xdg_util.h",
531    "numerics/safe_conversions.h",
532    "numerics/safe_conversions_impl.h",
533    "numerics/safe_math.h",
534    "numerics/safe_math_impl.h",
535    "observer_list.h",
536    "observer_list_threadsafe.h",
537    "os_compat_android.cc",
538    "os_compat_android.h",
539    "os_compat_nacl.cc",
540    "os_compat_nacl.h",
541    "path_service.cc",
542    "path_service.h",
543    "pending_task.cc",
544    "pending_task.h",
545    "pickle.cc",
546    "pickle.h",
547    "posix/eintr_wrapper.h",
548    "posix/file_descriptor_shuffle.cc",
549    "posix/global_descriptors.cc",
550    "posix/global_descriptors.h",
551    "posix/safe_strerror.cc",
552    "posix/safe_strerror.h",
553    "posix/unix_domain_socket_linux.cc",
554    "posix/unix_domain_socket_linux.h",
555    "power_monitor/power_monitor.cc",
556    "power_monitor/power_monitor.h",
557    "power_monitor/power_monitor_device_source.cc",
558    "power_monitor/power_monitor_device_source.h",
559    "power_monitor/power_monitor_device_source_android.cc",
560    "power_monitor/power_monitor_device_source_android.h",
561    "power_monitor/power_monitor_device_source_chromeos.cc",
562    "power_monitor/power_monitor_device_source_ios.mm",
563    "power_monitor/power_monitor_device_source_mac.mm",
564    "power_monitor/power_monitor_device_source_posix.cc",
565    "power_monitor/power_monitor_device_source_win.cc",
566    "power_monitor/power_monitor_source.cc",
567    "power_monitor/power_monitor_source.h",
568    "power_monitor/power_observer.h",
569    "process/internal_linux.cc",
570    "process/internal_linux.h",
571    "process/kill.cc",
572    "process/kill.h",
573    "process/kill_mac.cc",
574    "process/kill_posix.cc",
575    "process/kill_win.cc",
576    "process/launch.cc",
577    "process/launch.h",
578    "process/launch_ios.cc",
579    "process/launch_mac.cc",
580    "process/launch_posix.cc",
581    "process/launch_win.cc",
582    "process/memory.cc",
583    "process/memory.h",
584    "process/memory_linux.cc",
585    "process/memory_mac.mm",
586    "process/memory_win.cc",
587    "process/port_provider_mac.cc",
588    "process/port_provider_mac.h",
589    "process/process.h",
590    "process/process_handle.cc",
591
592    #"process/process_handle_freebsd.cc",  # Unused in Chromium build.
593    "process/process_handle_linux.cc",
594    "process/process_handle_mac.cc",
595
596    #"process/process_handle_openbsd.cc",  # Unused in Chromium build.
597    "process/process_handle_posix.cc",
598    "process/process_handle_win.cc",
599    "process/process_info.h",
600    "process/process_info_linux.cc",
601    "process/process_info_mac.cc",
602    "process/process_info_win.cc",
603    "process/process_iterator.cc",
604    "process/process_iterator.h",
605
606    #"process/process_iterator_freebsd.cc",  # Unused in Chromium build.
607    "process/process_iterator_linux.cc",
608    "process/process_iterator_mac.cc",
609
610    #"process/process_iterator_openbsd.cc",  # Unused in Chromium build.
611    "process/process_iterator_win.cc",
612    "process/process_linux.cc",
613    "process/process_metrics.cc",
614    "process/process_metrics.h",
615
616    #"process/process_metrics_freebsd.cc",  # Unused in Chromium build.
617    "process/process_metrics_ios.cc",
618    "process/process_metrics_linux.cc",
619    "process/process_metrics_mac.cc",
620
621    #"process/process_metrics_openbsd.cc",  # Unused in Chromium build.
622    "process/process_metrics_posix.cc",
623    "process/process_metrics_win.cc",
624    "process/process_posix.cc",
625    "process/process_win.cc",
626    "profiler/alternate_timer.cc",
627    "profiler/alternate_timer.h",
628    "profiler/native_stack_sampler.cc",
629    "profiler/native_stack_sampler.h",
630    "profiler/native_stack_sampler_posix.cc",
631    "profiler/native_stack_sampler_win.cc",
632    "profiler/scoped_profile.cc",
633    "profiler/scoped_profile.h",
634    "profiler/scoped_tracker.cc",
635    "profiler/scoped_tracker.h",
636    "profiler/stack_sampling_profiler.cc",
637    "profiler/stack_sampling_profiler.h",
638    "profiler/tracked_time.cc",
639    "profiler/tracked_time.h",
640    "rand_util.cc",
641    "rand_util.h",
642    "rand_util_nacl.cc",
643    "rand_util_posix.cc",
644    "rand_util_win.cc",
645    "run_loop.cc",
646    "run_loop.h",
647    "scoped_generic.h",
648    "scoped_native_library.cc",
649    "scoped_native_library.h",
650    "scoped_observer.h",
651    "sequence_checker.h",
652    "sequence_checker_impl.cc",
653    "sequence_checker_impl.h",
654    "sequenced_task_runner.cc",
655    "sequenced_task_runner.h",
656    "sequenced_task_runner_helpers.h",
657    "sha1.h",
658    "sha1_portable.cc",
659    "sha1_win.cc",
660    "single_thread_task_runner.h",
661    "stl_util.h",
662    "strings/latin1_string_conversions.cc",
663    "strings/latin1_string_conversions.h",
664    "strings/nullable_string16.cc",
665    "strings/nullable_string16.h",
666    "strings/pattern.cc",
667    "strings/pattern.h",
668    "strings/safe_sprintf.cc",
669    "strings/safe_sprintf.h",
670    "strings/string16.cc",
671    "strings/string16.h",
672    "strings/string_number_conversions.cc",
673    "strings/string_number_conversions.h",
674    "strings/string_piece.cc",
675    "strings/string_piece.h",
676    "strings/string_split.cc",
677    "strings/string_split.h",
678    "strings/string_tokenizer.h",
679    "strings/string_util.cc",
680    "strings/string_util.h",
681    "strings/string_util_constants.cc",
682    "strings/string_util_posix.h",
683    "strings/string_util_win.h",
684    "strings/stringize_macros.h",
685    "strings/stringprintf.cc",
686    "strings/stringprintf.h",
687    "strings/sys_string_conversions.h",
688    "strings/sys_string_conversions_mac.mm",
689    "strings/sys_string_conversions_posix.cc",
690    "strings/sys_string_conversions_win.cc",
691    "strings/utf_offset_string_conversions.cc",
692    "strings/utf_offset_string_conversions.h",
693    "strings/utf_string_conversion_utils.cc",
694    "strings/utf_string_conversion_utils.h",
695    "strings/utf_string_conversions.cc",
696    "strings/utf_string_conversions.h",
697    "supports_user_data.cc",
698    "supports_user_data.h",
699    "sync_socket.h",
700    "sync_socket_posix.cc",
701    "sync_socket_win.cc",
702    "synchronization/cancellation_flag.cc",
703    "synchronization/cancellation_flag.h",
704    "synchronization/condition_variable.h",
705    "synchronization/condition_variable_posix.cc",
706    "synchronization/condition_variable_win.cc",
707    "synchronization/lock.cc",
708    "synchronization/lock.h",
709    "synchronization/lock_impl.h",
710    "synchronization/lock_impl_posix.cc",
711    "synchronization/lock_impl_win.cc",
712    "synchronization/spin_wait.h",
713    "synchronization/waitable_event.h",
714    "synchronization/waitable_event_posix.cc",
715    "synchronization/waitable_event_watcher.h",
716    "synchronization/waitable_event_watcher_posix.cc",
717    "synchronization/waitable_event_watcher_win.cc",
718    "synchronization/waitable_event_win.cc",
719    "sys_byteorder.h",
720    "sys_info.cc",
721    "sys_info.h",
722    "sys_info_android.cc",
723    "sys_info_chromeos.cc",
724
725    #"sys_info_freebsd.cc",  # Unused in Chromium build.
726    "sys_info_ios.mm",
727    "sys_info_linux.cc",
728    "sys_info_mac.cc",
729
730    #"sys_info_openbsd.cc",  # Unused in Chromium build.
731    "sys_info_posix.cc",
732    "sys_info_win.cc",
733    "system_monitor/system_monitor.cc",
734    "system_monitor/system_monitor.h",
735    "task/cancelable_task_tracker.cc",
736    "task/cancelable_task_tracker.h",
737    "task_runner.cc",
738    "task_runner.h",
739    "task_runner_util.h",
740    "template_util.h",
741    "third_party/dmg_fp/dmg_fp.h",
742    "third_party/dmg_fp/dtoa_wrapper.cc",
743    "third_party/dmg_fp/g_fmt.cc",
744    "third_party/icu/icu_utf.cc",
745    "third_party/icu/icu_utf.h",
746    "third_party/nspr/prtime.cc",
747    "third_party/nspr/prtime.h",
748    "third_party/superfasthash/superfasthash.c",
749    "thread_task_runner_handle.cc",
750    "thread_task_runner_handle.h",
751    "threading/non_thread_safe.h",
752    "threading/non_thread_safe_impl.cc",
753    "threading/non_thread_safe_impl.h",
754    "threading/platform_thread.h",
755    "threading/platform_thread_android.cc",
756    "threading/platform_thread_internal_posix.cc",
757    "threading/platform_thread_internal_posix.h",
758    "threading/platform_thread_linux.cc",
759    "threading/platform_thread_mac.mm",
760    "threading/platform_thread_posix.cc",
761    "threading/platform_thread_win.cc",
762    "threading/post_task_and_reply_impl.cc",
763    "threading/post_task_and_reply_impl.h",
764    "threading/sequenced_task_runner_handle.cc",
765    "threading/sequenced_task_runner_handle.h",
766    "threading/sequenced_worker_pool.cc",
767    "threading/sequenced_worker_pool.h",
768    "threading/simple_thread.cc",
769    "threading/simple_thread.h",
770    "threading/thread.cc",
771    "threading/thread.h",
772    "threading/thread_checker.h",
773    "threading/thread_checker_impl.cc",
774    "threading/thread_checker_impl.h",
775    "threading/thread_collision_warner.cc",
776    "threading/thread_collision_warner.h",
777    "threading/thread_id_name_manager.cc",
778    "threading/thread_id_name_manager.h",
779    "threading/thread_local.h",
780    "threading/thread_local_android.cc",
781    "threading/thread_local_posix.cc",
782    "threading/thread_local_storage.cc",
783    "threading/thread_local_storage.h",
784    "threading/thread_local_storage_posix.cc",
785    "threading/thread_local_storage_win.cc",
786    "threading/thread_local_win.cc",
787    "threading/thread_restrictions.cc",
788    "threading/thread_restrictions.h",
789    "threading/watchdog.cc",
790    "threading/watchdog.h",
791    "threading/worker_pool.cc",
792    "threading/worker_pool.h",
793    "threading/worker_pool_posix.cc",
794    "threading/worker_pool_posix.h",
795    "threading/worker_pool_win.cc",
796    "time/clock.cc",
797    "time/clock.h",
798    "time/default_clock.cc",
799    "time/default_clock.h",
800    "time/default_tick_clock.cc",
801    "time/default_tick_clock.h",
802    "time/tick_clock.cc",
803    "time/tick_clock.h",
804    "time/time.cc",
805    "time/time.h",
806    "time/time_mac.cc",
807    "time/time_posix.cc",
808    "time/time_win.cc",
809    "timer/elapsed_timer.cc",
810    "timer/elapsed_timer.h",
811    "timer/hi_res_timer_manager.h",
812    "timer/hi_res_timer_manager_posix.cc",
813    "timer/hi_res_timer_manager_win.cc",
814    "timer/mock_timer.cc",
815    "timer/mock_timer.h",
816    "timer/timer.cc",
817    "timer/timer.h",
818    "trace_event/common/trace_event_common.h",
819    "trace_event/heap_profiler_allocation_context.cc",
820    "trace_event/heap_profiler_allocation_context.h",
821    "trace_event/heap_profiler_allocation_context_tracker.cc",
822    "trace_event/heap_profiler_allocation_context_tracker.h",
823    "trace_event/heap_profiler_allocation_register.cc",
824    "trace_event/heap_profiler_allocation_register.h",
825    "trace_event/heap_profiler_allocation_register_posix.cc",
826    "trace_event/heap_profiler_allocation_register_win.cc",
827    "trace_event/heap_profiler_heap_dump_writer.cc",
828    "trace_event/heap_profiler_heap_dump_writer.h",
829    "trace_event/heap_profiler_stack_frame_deduplicator.cc",
830    "trace_event/heap_profiler_stack_frame_deduplicator.h",
831    "trace_event/heap_profiler_type_name_deduplicator.cc",
832    "trace_event/heap_profiler_type_name_deduplicator.h",
833    "trace_event/java_heap_dump_provider_android.cc",
834    "trace_event/java_heap_dump_provider_android.h",
835    "trace_event/memory_allocator_dump.cc",
836    "trace_event/memory_allocator_dump.h",
837    "trace_event/memory_allocator_dump_guid.cc",
838    "trace_event/memory_allocator_dump_guid.h",
839    "trace_event/memory_dump_manager.cc",
840    "trace_event/memory_dump_manager.h",
841    "trace_event/memory_dump_provider.h",
842    "trace_event/memory_dump_request_args.cc",
843    "trace_event/memory_dump_request_args.h",
844    "trace_event/memory_dump_session_state.cc",
845    "trace_event/memory_dump_session_state.h",
846    "trace_event/process_memory_dump.cc",
847    "trace_event/process_memory_dump.h",
848    "trace_event/process_memory_maps.cc",
849    "trace_event/process_memory_maps.h",
850    "trace_event/process_memory_maps_dump_provider.h",
851    "trace_event/process_memory_totals.cc",
852    "trace_event/process_memory_totals.h",
853    "trace_event/process_memory_totals_dump_provider.cc",
854    "trace_event/process_memory_totals_dump_provider.h",
855    "trace_event/trace_buffer.cc",
856    "trace_event/trace_buffer.h",
857    "trace_event/trace_config.cc",
858    "trace_event/trace_config.h",
859    "trace_event/trace_event.h",
860    "trace_event/trace_event_android.cc",
861    "trace_event/trace_event_argument.cc",
862    "trace_event/trace_event_argument.h",
863    "trace_event/trace_event_etw_export_win.cc",
864    "trace_event/trace_event_etw_export_win.h",
865    "trace_event/trace_event_impl.cc",
866    "trace_event/trace_event_impl.h",
867    "trace_event/trace_event_memory_overhead.cc",
868    "trace_event/trace_event_memory_overhead.h",
869    "trace_event/trace_event_synthetic_delay.cc",
870    "trace_event/trace_event_synthetic_delay.h",
871    "trace_event/trace_event_system_stats_monitor.cc",
872    "trace_event/trace_event_system_stats_monitor.h",
873    "trace_event/trace_log.cc",
874    "trace_event/trace_log.h",
875    "trace_event/trace_log_constants.cc",
876    "trace_event/trace_sampling_thread.cc",
877    "trace_event/trace_sampling_thread.h",
878    "trace_event/tracing_agent.cc",
879    "trace_event/tracing_agent.h",
880    "trace_event/winheap_dump_provider_win.cc",
881    "trace_event/winheap_dump_provider_win.h",
882    "tracked_objects.cc",
883    "tracked_objects.h",
884    "tracking_info.cc",
885    "tracking_info.h",
886    "tuple.h",
887    "value_conversions.cc",
888    "value_conversions.h",
889    "values.cc",
890    "values.h",
891    "version.cc",
892    "version.h",
893    "vlog.cc",
894    "vlog.h",
895    "win/enum_variant.cc",
896    "win/enum_variant.h",
897    "win/event_trace_consumer.h",
898    "win/event_trace_controller.cc",
899    "win/event_trace_controller.h",
900    "win/event_trace_provider.cc",
901    "win/event_trace_provider.h",
902    "win/i18n.cc",
903    "win/i18n.h",
904    "win/iat_patch_function.cc",
905    "win/iat_patch_function.h",
906    "win/iunknown_impl.cc",
907    "win/iunknown_impl.h",
908    "win/message_window.cc",
909    "win/message_window.h",
910    "win/object_watcher.cc",
911    "win/object_watcher.h",
912    "win/process_startup_helper.cc",
913    "win/process_startup_helper.h",
914    "win/registry.cc",
915    "win/registry.h",
916    "win/resource_util.cc",
917    "win/resource_util.h",
918    "win/scoped_bstr.cc",
919    "win/scoped_bstr.h",
920    "win/scoped_co_mem.h",
921    "win/scoped_com_initializer.h",
922    "win/scoped_comptr.h",
923    "win/scoped_gdi_object.h",
924    "win/scoped_handle.cc",
925    "win/scoped_handle.h",
926    "win/scoped_hdc.h",
927    "win/scoped_hglobal.h",
928    "win/scoped_process_information.cc",
929    "win/scoped_process_information.h",
930    "win/scoped_propvariant.h",
931    "win/scoped_select_object.h",
932    "win/scoped_variant.cc",
933    "win/scoped_variant.h",
934    "win/shortcut.cc",
935    "win/shortcut.h",
936    "win/startup_information.cc",
937    "win/startup_information.h",
938    "win/win_util.cc",
939    "win/win_util.h",
940    "win/windows_version.cc",
941    "win/windows_version.h",
942    "win/wrapped_window_proc.cc",
943    "win/wrapped_window_proc.h",
944  ]
945
946  defines = []
947  data = []
948
949  configs += [
950    ":base_flags",
951    ":base_implementation",
952    "//base/allocator:allocator_shim_define",  # for allocator_check.cc.
953    "//build/config:precompiled_headers",
954  ]
955
956  deps = [
957    "//base/third_party/dynamic_annotations",
958    "//third_party/modp_b64",
959  ]
960
961  public_deps = [
962    ":base_paths",
963    ":base_static",
964    ":debugging_flags",
965  ]
966
967  # Allow more direct string conversions on platforms with native utf8
968  # strings
969  if (is_mac || is_ios || is_chromeos) {
970    defines += [ "SYSTEM_NATIVE_UTF8" ]
971  }
972
973  # Android.
974  if (is_android) {
975    sources -= [
976      "debug/stack_trace_posix.cc",
977      "power_monitor/power_monitor_device_source_posix.cc",
978    ]
979
980    # Android uses some Linux sources, put those back.
981    set_sources_assignment_filter([])
982    sources += [
983      "debug/proc_maps_linux.cc",
984      "files/file_path_watcher_linux.cc",
985      "posix/unix_domain_socket_linux.cc",
986      "process/internal_linux.cc",
987      "process/memory_linux.cc",
988      "process/process_handle_linux.cc",
989      "process/process_iterator_linux.cc",
990      "process/process_metrics_linux.cc",
991      "sys_info_linux.cc",
992      "trace_event/malloc_dump_provider.cc",
993      "trace_event/malloc_dump_provider.h",
994      "trace_event/process_memory_maps_dump_provider.cc",
995    ]
996    set_sources_assignment_filter(sources_assignment_filter)
997
998    deps += [
999      ":base_jni_headers",
1000      "//third_party/android_tools:cpu_features",
1001      "//third_party/ashmem",
1002    ]
1003
1004    # Needs to be a public config so that dependent targets link against it as
1005    # well when doing a component build.
1006    public_configs = [ ":android_system_libs" ]
1007  }
1008
1009  # Chromeos.
1010  if (is_chromeos) {
1011    sources -= [ "power_monitor/power_monitor_device_source_posix.cc" ]
1012  }
1013
1014  # NaCl.
1015  if (is_nacl) {
1016    # We reset sources_assignment_filter in order to explicitly include
1017    # the linux file (which would otherwise be filtered out).
1018    set_sources_assignment_filter([])
1019    sources += [
1020      "files/file_path_watcher_stub.cc",
1021      "process/process_metrics_nacl.cc",
1022      "sync_socket_nacl.cc",
1023      "threading/platform_thread_linux.cc",
1024    ]
1025    set_sources_assignment_filter(sources_assignment_filter)
1026
1027    sources -= [
1028      "cpu.cc",
1029      "debug/crash_logging.cc",
1030      "debug/crash_logging.h",
1031      "debug/stack_trace.cc",
1032      "debug/stack_trace_posix.cc",
1033      "files/file_enumerator_posix.cc",
1034      "files/file_proxy.cc",
1035      "files/file_util_proxy.cc",
1036      "files/important_file_writer.cc",
1037      "files/important_file_writer.h",
1038      "files/scoped_temp_dir.cc",
1039      "memory/discardable_memory.cc",
1040      "memory/discardable_memory.h",
1041      "memory/discardable_memory_allocator.cc",
1042      "memory/discardable_memory_allocator.h",
1043      "memory/discardable_shared_memory.cc",
1044      "memory/discardable_shared_memory.h",
1045      "memory/shared_memory_posix.cc",
1046      "native_library_posix.cc",
1047      "path_service.cc",
1048      "process/kill.cc",
1049      "process/kill.h",
1050      "process/memory.cc",
1051      "process/memory.h",
1052      "process/process_iterator.cc",
1053      "process/process_iterator.h",
1054      "process/process_metrics.cc",
1055      "process/process_metrics_posix.cc",
1056      "process/process_posix.cc",
1057      "scoped_native_library.cc",
1058      "sync_socket_posix.cc",
1059      "sys_info.cc",
1060      "sys_info_posix.cc",
1061      "trace_event/process_memory_totals_dump_provider.cc",
1062      "trace_event/trace_event_system_stats_monitor.cc",
1063    ]
1064
1065    if (is_nacl_nonsfi) {
1066      set_sources_assignment_filter([])
1067      sources += [ "posix/unix_domain_socket_linux.cc" ]
1068      set_sources_assignment_filter(sources_assignment_filter)
1069      sources -= [ "rand_util_nacl.cc" ]
1070      configs += [ ":nacl_nonsfi_warnings" ]
1071    } else {
1072      sources -= [
1073        "files/file_util.cc",
1074        "files/file_util.h",
1075        "files/file_util_posix.cc",
1076        "json/json_file_value_serializer.cc",
1077        "json/json_file_value_serializer.h",
1078        "message_loop/message_pump_libevent.cc",
1079        "message_loop/message_pump_libevent.h",
1080        "process/kill_posix.cc",
1081        "process/launch.cc",
1082        "process/launch.h",
1083        "process/launch_posix.cc",
1084        "rand_util_posix.cc",
1085      ]
1086    }
1087  } else {
1088    # Remove NaCl stuff.
1089    sources -= [
1090      "memory/shared_memory_nacl.cc",
1091      "os_compat_nacl.cc",
1092      "os_compat_nacl.h",
1093      "rand_util_nacl.cc",
1094    ]
1095  }
1096
1097  # Windows.
1098  if (is_win) {
1099    sources += [
1100      "profiler/win32_stack_frame_unwinder.cc",
1101      "profiler/win32_stack_frame_unwinder.h",
1102    ]
1103
1104    sources -= [
1105      "message_loop/message_pump_libevent.cc",
1106      "strings/string16.cc",
1107
1108      # Not using sha1_win.cc because it may have caused a
1109      # regression to page cycler moz.
1110      "sha1_win.cc",
1111    ]
1112
1113    # Required for base/stack_trace_win.cc to symbolize correctly.
1114    data += [ "$root_build_dir/dbghelp.dll" ]
1115
1116    deps += [ "//base/trace_event/etw_manifest:chrome_events_win" ]
1117
1118    if (is_component_build) {
1119      # Copy the VS runtime DLLs into the isolate so that they don't have to be
1120      # preinstalled on the target machine. The debug runtimes have a "d" at
1121      # the end.
1122      if (is_debug) {
1123        vcrt_suffix = "d"
1124      } else {
1125        vcrt_suffix = ""
1126      }
1127
1128      # These runtime files are copied to the output directory by the
1129      # vs_toolchain script that runs as part of toolchain configuration.
1130      data += [
1131        "$root_out_dir/msvcp120${vcrt_suffix}.dll",
1132        "$root_out_dir/msvcr120${vcrt_suffix}.dll",
1133      ]
1134      if (is_asan) {
1135        data += [ "//third_party/llvm-build/Release+Asserts/lib/clang/3.8.0/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
1136      }
1137    }
1138
1139    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1140    configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1141
1142    libs = [
1143      "cfgmgr32.lib",
1144      "netapi32.lib",
1145      "powrprof.lib",
1146      "setupapi.lib",
1147    ]
1148    all_dependent_configs = [ ":base_win_linker_flags" ]
1149  } else if (!is_nacl || is_nacl_nonsfi) {
1150    # Non-Windows.
1151    deps += [ "//base/third_party/libevent" ]
1152  }
1153
1154  # Desktop Mac.
1155  if (is_mac) {
1156    sources += [
1157      "trace_event/malloc_dump_provider.cc",
1158      "trace_event/malloc_dump_provider.h",
1159    ]
1160  }
1161
1162  # Mac or iOS.
1163  if (is_mac || is_ios) {
1164    sources -= [
1165      "memory/shared_memory_posix.cc",
1166      "native_library_posix.cc",
1167      "strings/sys_string_conversions_posix.cc",
1168      "threading/platform_thread_internal_posix.cc",
1169    ]
1170
1171    if (is_asan) {
1172      # TODO(GYP) hook up asan on Mac. GYP has this extra dylib:
1173      #data += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
1174    }
1175  } else {
1176    # Non-Mac/ios.
1177    sources -= [
1178      "files/file_path_watcher_fsevents.cc",
1179      "files/file_path_watcher_fsevents.h",
1180      "files/file_path_watcher_kqueue.cc",
1181      "files/file_path_watcher_kqueue.h",
1182    ]
1183  }
1184
1185  # Linux.
1186  if (is_linux) {
1187    sources += [
1188      "trace_event/malloc_dump_provider.cc",
1189      "trace_event/malloc_dump_provider.h",
1190      "trace_event/process_memory_maps_dump_provider.cc",
1191    ]
1192
1193    if (is_asan || is_lsan || is_msan || is_tsan) {
1194      # For llvm-sanitizer.
1195      data += [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ]
1196    }
1197
1198    # TODO(brettw) this will need to be parameterized at some point.
1199    linux_configs = []
1200    if (use_glib) {
1201      linux_configs += [ "//build/config/linux:glib" ]
1202    }
1203
1204    defines += [ "USE_SYMBOLIZE" ]
1205
1206    configs += linux_configs
1207    all_dependent_configs = linux_configs
1208
1209    # These dependencies are not required on Android, and in the case
1210    # of xdg_mime must be excluded due to licensing restrictions.
1211    deps += [
1212      "//base/third_party/symbolize",
1213      "//base/third_party/xdg_mime",
1214      "//base/third_party/xdg_user_dirs",
1215    ]
1216  } else {
1217    # Non-Linux.
1218    sources -= [
1219      "nix/mime_util_xdg.cc",
1220      "nix/mime_util_xdg.h",
1221      "nix/xdg_util.cc",
1222      "nix/xdg_util.h",
1223    ]
1224
1225    if (!is_android) {
1226      sources -= [
1227        "linux_util.cc",
1228        "linux_util.h",
1229      ]
1230    }
1231  }
1232
1233  # iOS
1234  if (is_ios) {
1235    set_sources_assignment_filter([])
1236
1237    sources -= [
1238      "files/file_path_watcher.cc",
1239      "files/file_path_watcher.h",
1240      "files/file_path_watcher_fsevents.cc",
1241      "files/file_path_watcher_fsevents.h",
1242      "files/file_path_watcher_kqueue.cc",
1243      "files/file_path_watcher_kqueue.h",
1244      "memory/discardable_shared_memory.cc",
1245      "memory/discardable_shared_memory.h",
1246      "message_loop/message_pump_libevent.cc",
1247      "message_loop/message_pump_libevent.h",
1248      "process/kill.cc",
1249      "process/kill.h",
1250      "process/kill_posix.cc",
1251      "process/launch.cc",
1252      "process/launch.h",
1253      "process/launch_posix.cc",
1254      "process/memory.cc",
1255      "process/memory.h",
1256      "process/process_iterator.cc",
1257      "process/process_iterator.h",
1258      "process/process_metrics_posix.cc",
1259      "process/process_posix.cc",
1260      "sync_socket.h",
1261      "sync_socket_posix.cc",
1262    ]
1263    sources += [
1264      "base_paths_mac.h",
1265      "base_paths_mac.mm",
1266      "file_version_info_mac.h",
1267      "file_version_info_mac.mm",
1268      "files/file_util_mac.mm",
1269      "mac/bundle_locations.h",
1270      "mac/bundle_locations.mm",
1271      "mac/call_with_eh_frame.cc",
1272      "mac/call_with_eh_frame.h",
1273      "mac/foundation_util.h",
1274      "mac/foundation_util.mm",
1275      "mac/mac_logging.cc",
1276      "mac/mac_logging.h",
1277      "mac/mach_logging.cc",
1278      "mac/mach_logging.h",
1279      "mac/objc_property_releaser.h",
1280      "mac/objc_property_releaser.mm",
1281      "mac/scoped_mach_port.cc",
1282      "mac/scoped_mach_port.h",
1283      "mac/scoped_mach_vm.cc",
1284      "mac/scoped_mach_vm.h",
1285      "mac/scoped_nsautorelease_pool.h",
1286      "mac/scoped_nsautorelease_pool.mm",
1287      "mac/scoped_nsobject.h",
1288      "mac/scoped_objc_class_swizzler.h",
1289      "mac/scoped_objc_class_swizzler.mm",
1290      "message_loop/message_pump_mac.h",
1291      "message_loop/message_pump_mac.mm",
1292      "process/memory_stubs.cc",
1293      "strings/sys_string_conversions_mac.mm",
1294      "threading/platform_thread_mac.mm",
1295      "time/time_mac.cc",
1296    ]
1297
1298    set_sources_assignment_filter(sources_assignment_filter)
1299  }
1300
1301  if (!use_glib) {
1302    sources -= [
1303      "message_loop/message_pump_glib.cc",
1304      "message_loop/message_pump_glib.h",
1305    ]
1306  }
1307
1308  if (is_asan || is_lsan || is_msan || is_tsan) {
1309    data += [ "//tools/valgrind/asan/" ]
1310    if (is_win) {
1311      data +=
1312          [ "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer.exe" ]
1313    } else {
1314      data += [ "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer" ]
1315    }
1316  }
1317
1318  configs += [ "//build/config/compiler:wexit_time_destructors" ]
1319  if (!is_debug) {
1320    configs -= [ "//build/config/compiler:default_optimization" ]
1321    configs += [ "//build/config/compiler:optimize_max" ]
1322  }
1323
1324  allow_circular_includes_from = public_deps
1325}
1326
1327buildflag_header("debugging_flags") {
1328  header = "debugging_flags.h"
1329  header_dir = "base/debug"
1330  flags = [ "ENABLE_PROFILING=$enable_profiling" ]
1331}
1332
1333# This is the subset of files from base that should not be used with a dynamic
1334# library. Note that this library cannot depend on base because base depends on
1335# base_static.
1336static_library("base_static") {
1337  sources = [
1338    "base_switches.cc",
1339    "base_switches.h",
1340    "win/pe_image.cc",
1341    "win/pe_image.h",
1342  ]
1343
1344  if (!is_debug) {
1345    configs -= [ "//build/config/compiler:default_optimization" ]
1346    configs += [ "//build/config/compiler:optimize_max" ]
1347  }
1348}
1349
1350component("i18n") {
1351  output_name = "base_i18n"
1352  sources = [
1353    "i18n/base_i18n_export.h",
1354    "i18n/base_i18n_switches.cc",
1355    "i18n/base_i18n_switches.h",
1356    "i18n/bidi_line_iterator.cc",
1357    "i18n/bidi_line_iterator.h",
1358    "i18n/break_iterator.cc",
1359    "i18n/break_iterator.h",
1360    "i18n/case_conversion.cc",
1361    "i18n/case_conversion.h",
1362    "i18n/char_iterator.cc",
1363    "i18n/char_iterator.h",
1364    "i18n/file_util_icu.cc",
1365    "i18n/file_util_icu.h",
1366    "i18n/i18n_constants.cc",
1367    "i18n/i18n_constants.h",
1368    "i18n/icu_encoding_detection.cc",
1369    "i18n/icu_encoding_detection.h",
1370    "i18n/icu_string_conversions.cc",
1371    "i18n/icu_string_conversions.h",
1372    "i18n/icu_util.cc",
1373    "i18n/icu_util.h",
1374    "i18n/message_formatter.cc",
1375    "i18n/message_formatter.h",
1376    "i18n/number_formatting.cc",
1377    "i18n/number_formatting.h",
1378    "i18n/rtl.cc",
1379    "i18n/rtl.h",
1380    "i18n/streaming_utf8_validator.cc",
1381    "i18n/streaming_utf8_validator.h",
1382    "i18n/string_compare.cc",
1383    "i18n/string_compare.h",
1384    "i18n/string_search.cc",
1385    "i18n/string_search.h",
1386    "i18n/time_formatting.cc",
1387    "i18n/time_formatting.h",
1388    "i18n/timezone.cc",
1389    "i18n/timezone.h",
1390    "i18n/utf8_validator_tables.cc",
1391    "i18n/utf8_validator_tables.h",
1392  ]
1393  defines = [ "BASE_I18N_IMPLEMENTATION" ]
1394  configs += [ "//build/config/compiler:wexit_time_destructors" ]
1395  public_deps = [
1396    "//third_party/icu",
1397  ]
1398  deps = [
1399    ":base",
1400    "//base/third_party/dynamic_annotations",
1401  ]
1402
1403  if (!is_debug) {
1404    configs -= [ "//build/config/compiler:default_optimization" ]
1405    configs += [ "//build/config/compiler:optimize_max" ]
1406  }
1407
1408  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1409  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1410}
1411
1412if (is_ios || is_android || is_win || (is_linux && !is_chromeos)) {
1413  # TODO(GYP): Figure out which of these work and are needed on other platforms.
1414  test("base_perftests") {
1415    sources = [
1416      "message_loop/message_pump_perftest.cc",
1417
1418      # "test/run_all_unittests.cc",
1419      "threading/thread_perftest.cc",
1420    ]
1421    deps = [
1422      ":base",
1423      "//base/test:test_support",
1424      "//base/test:test_support_perf",
1425      "//testing/gtest",
1426      "//testing/perf",
1427    ]
1428
1429    if (is_android) {
1430      deps += [ "//testing/android/native_test:native_test_native_code" ]
1431    }
1432  }
1433
1434  test("base_i18n_perftests") {
1435    sources = [
1436      "i18n/streaming_utf8_validator_perftest.cc",
1437    ]
1438    deps = [
1439      ":base",
1440      ":i18n",
1441      "//base/test:test_support",
1442      "//base/test:test_support_perf",
1443      "//testing/gtest",
1444    ]
1445  }
1446
1447  if (!is_ios) {
1448    executable("build_utf8_validator_tables") {
1449      sources = [
1450        "i18n/build_utf8_validator_tables.cc",
1451      ]
1452      deps = [
1453        ":base",
1454        "//build/config/sanitizers:deps",
1455        "//third_party/icu:icuuc",
1456      ]
1457    }
1458
1459    executable("check_example") {
1460      sources = [
1461        "check_example.cc",
1462      ]
1463      deps = [
1464        ":base",
1465        "//build/config/sanitizers:deps",
1466      ]
1467    }
1468  }
1469}
1470
1471component("prefs") {
1472  sources = [
1473    "prefs/default_pref_store.cc",
1474    "prefs/default_pref_store.h",
1475    "prefs/json_pref_store.cc",
1476    "prefs/json_pref_store.h",
1477    "prefs/overlay_user_pref_store.cc",
1478    "prefs/overlay_user_pref_store.h",
1479    "prefs/pref_change_registrar.cc",
1480    "prefs/pref_change_registrar.h",
1481    "prefs/pref_member.cc",
1482    "prefs/pref_member.h",
1483    "prefs/pref_notifier_impl.cc",
1484    "prefs/pref_notifier_impl.h",
1485    "prefs/pref_registry.cc",
1486    "prefs/pref_registry.h",
1487    "prefs/pref_registry_simple.cc",
1488    "prefs/pref_registry_simple.h",
1489    "prefs/pref_service.cc",
1490    "prefs/pref_service.h",
1491    "prefs/pref_service_factory.cc",
1492    "prefs/pref_service_factory.h",
1493    "prefs/pref_store.cc",
1494    "prefs/pref_store.h",
1495    "prefs/pref_value_map.cc",
1496    "prefs/pref_value_map.h",
1497    "prefs/pref_value_store.cc",
1498    "prefs/pref_value_store.h",
1499    "prefs/scoped_user_pref_update.cc",
1500    "prefs/scoped_user_pref_update.h",
1501    "prefs/value_map_pref_store.cc",
1502    "prefs/value_map_pref_store.h",
1503  ]
1504  if (!is_ios) {
1505    sources += [
1506      "prefs/base_prefs_export.h",
1507      "prefs/persistent_pref_store.h",
1508      "prefs/pref_filter.h",
1509      "prefs/pref_notifier.h",
1510      "prefs/pref_observer.h",
1511      "prefs/writeable_pref_store.h",
1512    ]
1513  }
1514
1515  defines = [ "BASE_PREFS_IMPLEMENTATION" ]
1516
1517  deps = [
1518    ":base",
1519  ]
1520
1521  if (!is_debug) {
1522    configs -= [ "//build/config/compiler:default_optimization" ]
1523    configs += [ "//build/config/compiler:optimize_max" ]
1524  }
1525}
1526
1527source_set("prefs_test_support") {
1528  testonly = true
1529  sources = [
1530    "prefs/mock_pref_change_callback.cc",
1531    "prefs/mock_pref_change_callback.h",
1532    "prefs/pref_store_observer_mock.cc",
1533    "prefs/pref_store_observer_mock.h",
1534    "prefs/testing_pref_service.cc",
1535    "prefs/testing_pref_service.h",
1536    "prefs/testing_pref_store.cc",
1537    "prefs/testing_pref_store.h",
1538  ]
1539
1540  public_deps = [
1541    ":prefs",
1542  ]
1543  deps = [
1544    ":base",
1545    "//testing/gmock",
1546    "//testing/gtest",
1547  ]
1548}
1549
1550source_set("message_loop_tests") {
1551  testonly = true
1552  sources = [
1553    "message_loop/message_loop_test.cc",
1554    "message_loop/message_loop_test.h",
1555  ]
1556
1557  deps = [
1558    ":base",
1559    "//testing/gtest",
1560  ]
1561}
1562
1563if (is_win) {
1564  # Target to manually rebuild pe_image_test.dll which is checked into
1565  # base/test/data/pe_image.
1566  shared_library("pe_image_test") {
1567    sources = [
1568      "win/pe_image_test.cc",
1569    ]
1570    ldflags = [
1571      "/DELAYLOAD:cfgmgr32.dll",
1572      "/DELAYLOAD:shell32.dll",
1573      "/SUBSYSTEM:WINDOWS",
1574    ]
1575    libs = [
1576      "cfgmgr32.lib",
1577      "shell32.lib",
1578    ]
1579    deps = [
1580      "//build/config/sanitizers:deps",
1581    ]
1582  }
1583
1584  if (target_cpu == "x64") {
1585    # Must be a shared library so that it can be unloaded during testing.
1586    shared_library("base_profiler_test_support_library") {
1587      sources = [
1588        "profiler/test_support_library.cc",
1589      ]
1590      deps = [
1591        "//build/config/sanitizers:deps",
1592      ]
1593    }
1594  }
1595}
1596
1597# TODO(GYP): Delete this after we've converted everything to GN.
1598# The _run targets exist only for compatibility w/ GYP.
1599group("base_unittests_run") {
1600  testonly = true
1601  deps = [
1602    ":base_unittests",
1603  ]
1604}
1605
1606test("base_unittests") {
1607  sources = [
1608    "allocator/tcmalloc_unittest.cc",
1609    "android/application_status_listener_unittest.cc",
1610    "android/content_uri_utils_unittest.cc",
1611    "android/jni_android_unittest.cc",
1612    "android/jni_array_unittest.cc",
1613    "android/jni_string_unittest.cc",
1614    "android/library_loader/library_prefetcher_unittest.cc",
1615    "android/path_utils_unittest.cc",
1616    "android/scoped_java_ref_unittest.cc",
1617    "android/sys_utils_unittest.cc",
1618    "at_exit_unittest.cc",
1619    "atomicops_unittest.cc",
1620    "barrier_closure_unittest.cc",
1621    "base64_unittest.cc",
1622    "base64url_unittest.cc",
1623    "big_endian_unittest.cc",
1624    "bind_unittest.cc",
1625    "bits_unittest.cc",
1626    "build_time_unittest.cc",
1627    "callback_helpers_unittest.cc",
1628    "callback_list_unittest.cc",
1629    "callback_unittest.cc",
1630    "cancelable_callback_unittest.cc",
1631    "command_line_unittest.cc",
1632    "containers/adapters_unittest.cc",
1633    "containers/hash_tables_unittest.cc",
1634    "containers/linked_list_unittest.cc",
1635    "containers/mru_cache_unittest.cc",
1636    "containers/scoped_ptr_hash_map_unittest.cc",
1637    "containers/small_map_unittest.cc",
1638    "containers/stack_container_unittest.cc",
1639    "cpu_unittest.cc",
1640    "debug/crash_logging_unittest.cc",
1641    "debug/debugger_unittest.cc",
1642    "debug/leak_tracker_unittest.cc",
1643    "debug/proc_maps_linux_unittest.cc",
1644    "debug/stack_trace_unittest.cc",
1645    "debug/task_annotator_unittest.cc",
1646    "deferred_sequenced_task_runner_unittest.cc",
1647    "environment_unittest.cc",
1648    "file_version_info_unittest.cc",
1649    "files/dir_reader_posix_unittest.cc",
1650    "files/file_locking_unittest.cc",
1651    "files/file_path_unittest.cc",
1652    "files/file_path_watcher_unittest.cc",
1653    "files/file_proxy_unittest.cc",
1654    "files/file_unittest.cc",
1655    "files/file_util_proxy_unittest.cc",
1656    "files/file_util_unittest.cc",
1657    "files/important_file_writer_unittest.cc",
1658    "files/memory_mapped_file_unittest.cc",
1659    "files/scoped_temp_dir_unittest.cc",
1660    "gmock_unittest.cc",
1661    "guid_unittest.cc",
1662    "hash_unittest.cc",
1663    "i18n/break_iterator_unittest.cc",
1664    "i18n/case_conversion_unittest.cc",
1665    "i18n/char_iterator_unittest.cc",
1666    "i18n/file_util_icu_unittest.cc",
1667    "i18n/icu_string_conversions_unittest.cc",
1668    "i18n/message_formatter_unittest.cc",
1669    "i18n/number_formatting_unittest.cc",
1670    "i18n/rtl_unittest.cc",
1671    "i18n/streaming_utf8_validator_unittest.cc",
1672    "i18n/string_search_unittest.cc",
1673    "i18n/time_formatting_unittest.cc",
1674    "i18n/timezone_unittest.cc",
1675    "id_map_unittest.cc",
1676    "ios/device_util_unittest.mm",
1677    "ios/weak_nsobject_unittest.mm",
1678    "json/json_parser_unittest.cc",
1679    "json/json_reader_unittest.cc",
1680    "json/json_value_converter_unittest.cc",
1681    "json/json_value_serializer_unittest.cc",
1682    "json/json_writer_unittest.cc",
1683    "json/string_escape_unittest.cc",
1684    "lazy_instance_unittest.cc",
1685    "logging_unittest.cc",
1686    "mac/bind_objc_block_unittest.mm",
1687    "mac/call_with_eh_frame_unittest.mm",
1688    "mac/dispatch_source_mach_unittest.cc",
1689    "mac/foundation_util_unittest.mm",
1690    "mac/libdispatch_task_runner_unittest.cc",
1691    "mac/mac_util_unittest.mm",
1692    "mac/objc_property_releaser_unittest.mm",
1693    "mac/scoped_nsobject_unittest.mm",
1694    "mac/scoped_objc_class_swizzler_unittest.mm",
1695    "mac/scoped_sending_event_unittest.mm",
1696    "md5_unittest.cc",
1697    "memory/aligned_memory_unittest.cc",
1698    "memory/discardable_shared_memory_unittest.cc",
1699    "memory/linked_ptr_unittest.cc",
1700    "memory/memory_pressure_monitor_chromeos_unittest.cc",
1701    "memory/memory_pressure_monitor_win_unittest.cc",
1702    "memory/ptr_util_unittest.cc",
1703    "memory/ref_counted_memory_unittest.cc",
1704    "memory/ref_counted_unittest.cc",
1705    "memory/scoped_ptr_unittest.cc",
1706    "memory/scoped_vector_unittest.cc",
1707    "memory/shared_memory_mac_unittest.cc",
1708    "memory/shared_memory_unittest.cc",
1709    "memory/singleton_unittest.cc",
1710    "memory/weak_ptr_unittest.cc",
1711    "message_loop/message_loop_task_runner_unittest.cc",
1712    "message_loop/message_loop_unittest.cc",
1713    "message_loop/message_pump_glib_unittest.cc",
1714    "message_loop/message_pump_io_ios_unittest.cc",
1715    "metrics/bucket_ranges_unittest.cc",
1716    "metrics/field_trial_unittest.cc",
1717    "metrics/histogram_base_unittest.cc",
1718    "metrics/histogram_delta_serialization_unittest.cc",
1719    "metrics/histogram_macros_unittest.cc",
1720    "metrics/histogram_snapshot_manager_unittest.cc",
1721    "metrics/histogram_unittest.cc",
1722    "metrics/metrics_hashes_unittest.cc",
1723    "metrics/sample_map_unittest.cc",
1724    "metrics/sample_vector_unittest.cc",
1725    "metrics/sparse_histogram_unittest.cc",
1726    "metrics/statistics_recorder_unittest.cc",
1727    "native_library_unittest.cc",
1728    "numerics/safe_numerics_unittest.cc",
1729    "observer_list_unittest.cc",
1730    "os_compat_android_unittest.cc",
1731    "path_service_unittest.cc",
1732    "pickle_unittest.cc",
1733    "posix/file_descriptor_shuffle_unittest.cc",
1734    "posix/unix_domain_socket_linux_unittest.cc",
1735    "power_monitor/power_monitor_unittest.cc",
1736    "prefs/default_pref_store_unittest.cc",
1737    "prefs/json_pref_store_unittest.cc",
1738    "prefs/overlay_user_pref_store_unittest.cc",
1739    "prefs/pref_change_registrar_unittest.cc",
1740    "prefs/pref_member_unittest.cc",
1741    "prefs/pref_notifier_impl_unittest.cc",
1742    "prefs/pref_service_unittest.cc",
1743    "prefs/pref_value_map_unittest.cc",
1744    "prefs/pref_value_store_unittest.cc",
1745    "prefs/scoped_user_pref_update_unittest.cc",
1746    "process/memory_unittest.cc",
1747    "process/memory_unittest_mac.h",
1748    "process/memory_unittest_mac.mm",
1749    "process/process_metrics_unittest.cc",
1750    "process/process_metrics_unittest_ios.cc",
1751    "process/process_unittest.cc",
1752    "process/process_util_unittest.cc",
1753    "profiler/stack_sampling_profiler_unittest.cc",
1754    "profiler/tracked_time_unittest.cc",
1755    "rand_util_unittest.cc",
1756    "scoped_clear_errno_unittest.cc",
1757    "scoped_generic_unittest.cc",
1758    "scoped_native_library_unittest.cc",
1759    "security_unittest.cc",
1760    "sequence_checker_unittest.cc",
1761    "sha1_unittest.cc",
1762    "stl_util_unittest.cc",
1763    "strings/nullable_string16_unittest.cc",
1764    "strings/pattern_unittest.cc",
1765    "strings/safe_sprintf_unittest.cc",
1766    "strings/string16_unittest.cc",
1767    "strings/string_number_conversions_unittest.cc",
1768    "strings/string_piece_unittest.cc",
1769    "strings/string_split_unittest.cc",
1770    "strings/string_tokenizer_unittest.cc",
1771    "strings/string_util_unittest.cc",
1772    "strings/stringize_macros_unittest.cc",
1773    "strings/stringprintf_unittest.cc",
1774    "strings/sys_string_conversions_mac_unittest.mm",
1775    "strings/sys_string_conversions_unittest.cc",
1776    "strings/utf_offset_string_conversions_unittest.cc",
1777    "strings/utf_string_conversions_unittest.cc",
1778    "supports_user_data_unittest.cc",
1779    "sync_socket_unittest.cc",
1780    "synchronization/cancellation_flag_unittest.cc",
1781    "synchronization/condition_variable_unittest.cc",
1782    "synchronization/lock_unittest.cc",
1783    "synchronization/waitable_event_unittest.cc",
1784    "synchronization/waitable_event_watcher_unittest.cc",
1785    "sys_info_unittest.cc",
1786    "system_monitor/system_monitor_unittest.cc",
1787    "task/cancelable_task_tracker_unittest.cc",
1788    "task_runner_util_unittest.cc",
1789    "template_util_unittest.cc",
1790    "test/histogram_tester_unittest.cc",
1791    "test/icu_test_util.cc",
1792    "test/icu_test_util.h",
1793    "test/test_pending_task_unittest.cc",
1794    "test/test_reg_util_win_unittest.cc",
1795    "test/trace_event_analyzer_unittest.cc",
1796    "test/user_action_tester_unittest.cc",
1797    "threading/non_thread_safe_unittest.cc",
1798    "threading/platform_thread_unittest.cc",
1799    "threading/sequenced_task_runner_handle_unittest.cc",
1800    "threading/sequenced_worker_pool_unittest.cc",
1801    "threading/simple_thread_unittest.cc",
1802    "threading/thread_checker_unittest.cc",
1803    "threading/thread_collision_warner_unittest.cc",
1804    "threading/thread_id_name_manager_unittest.cc",
1805    "threading/thread_local_storage_unittest.cc",
1806    "threading/thread_local_unittest.cc",
1807    "threading/thread_unittest.cc",
1808    "threading/watchdog_unittest.cc",
1809    "threading/worker_pool_posix_unittest.cc",
1810    "threading/worker_pool_unittest.cc",
1811    "time/pr_time_unittest.cc",
1812    "time/time_unittest.cc",
1813    "time/time_win_unittest.cc",
1814    "timer/hi_res_timer_manager_unittest.cc",
1815    "timer/mock_timer_unittest.cc",
1816    "timer/timer_unittest.cc",
1817    "tools_sanity_unittest.cc",
1818    "trace_event/heap_profiler_allocation_context_tracker_unittest.cc",
1819    "trace_event/heap_profiler_allocation_register_unittest.cc",
1820    "trace_event/heap_profiler_heap_dump_writer_unittest.cc",
1821    "trace_event/heap_profiler_stack_frame_deduplicator_unittest.cc",
1822    "trace_event/heap_profiler_type_name_deduplicator_unittest.cc",
1823    "trace_event/java_heap_dump_provider_android_unittest.cc",
1824    "trace_event/memory_allocator_dump_unittest.cc",
1825    "trace_event/memory_dump_manager_unittest.cc",
1826    "trace_event/process_memory_dump_unittest.cc",
1827    "trace_event/process_memory_totals_dump_provider_unittest.cc",
1828    "trace_event/trace_config_memory_test_util.h",
1829    "trace_event/trace_config_unittest.cc",
1830    "trace_event/trace_event_argument_unittest.cc",
1831    "trace_event/trace_event_synthetic_delay_unittest.cc",
1832    "trace_event/trace_event_system_stats_monitor_unittest.cc",
1833    "trace_event/trace_event_unittest.cc",
1834    "trace_event/winheap_dump_provider_win_unittest.cc",
1835    "tracked_objects_unittest.cc",
1836    "tuple_unittest.cc",
1837    "values_unittest.cc",
1838    "version_unittest.cc",
1839    "vlog_unittest.cc",
1840    "win/dllmain.cc",
1841    "win/enum_variant_unittest.cc",
1842    "win/event_trace_consumer_unittest.cc",
1843    "win/event_trace_controller_unittest.cc",
1844    "win/event_trace_provider_unittest.cc",
1845    "win/i18n_unittest.cc",
1846    "win/iunknown_impl_unittest.cc",
1847    "win/message_window_unittest.cc",
1848    "win/object_watcher_unittest.cc",
1849    "win/pe_image_unittest.cc",
1850    "win/registry_unittest.cc",
1851    "win/scoped_bstr_unittest.cc",
1852    "win/scoped_comptr_unittest.cc",
1853    "win/scoped_handle_unittest.cc",
1854    "win/scoped_process_information_unittest.cc",
1855    "win/scoped_variant_unittest.cc",
1856    "win/shortcut_unittest.cc",
1857    "win/startup_information_unittest.cc",
1858    "win/win_util_unittest.cc",
1859    "win/wrapped_window_proc_unittest.cc",
1860  ]
1861
1862  deps = [
1863    ":base",
1864    ":i18n",
1865    ":message_loop_tests",
1866    ":prefs",
1867    ":prefs_test_support",
1868    "//base/allocator",
1869    "//base/test:run_all_unittests",
1870    "//base/test:test_support",
1871    "//base/third_party/dynamic_annotations",
1872    "//testing/gmock",
1873    "//testing/gtest",
1874    "//third_party/icu",
1875  ]
1876
1877  data = [
1878    "test/data/",
1879  ]
1880
1881  # Allow more direct string conversions on platforms with native utf8
1882  # strings
1883  if (is_mac || is_ios || is_chromeos) {
1884    defines = [ "SYSTEM_NATIVE_UTF8" ]
1885  }
1886
1887  if (is_android) {
1888    deps += [
1889      ":base_java",
1890      ":base_java_unittest_support",
1891      "//base/android/jni_generator:jni_generator_tests",
1892    ]
1893
1894    # TODO(brettw) I think this should not be here, we should not be using
1895    # isolate files.
1896    isolate_file = "base_unittests.isolate"
1897  }
1898
1899  if (is_ios) {
1900    sources -= [
1901      "files/file_locking_unittest.cc",
1902      "files/file_path_watcher_unittest.cc",
1903      "memory/discardable_shared_memory_unittest.cc",
1904      "memory/shared_memory_unittest.cc",
1905      "process/memory_unittest.cc",
1906      "process/process_unittest.cc",
1907      "process/process_util_unittest.cc",
1908      "sync_socket_unittest.cc",
1909    ]
1910
1911    # Pull in specific Mac files for iOS (which have been filtered out by file
1912    # name rules).
1913    set_sources_assignment_filter([])
1914    sources += [
1915      "mac/bind_objc_block_unittest.mm",
1916      "mac/foundation_util_unittest.mm",
1917      "mac/objc_property_releaser_unittest.mm",
1918      "mac/scoped_nsobject_unittest.mm",
1919      "strings/sys_string_conversions_mac_unittest.mm",
1920    ]
1921    set_sources_assignment_filter(sources_assignment_filter)
1922
1923    # TODO(GYP): dep on copy_test_data_ios action.
1924  }
1925
1926  if (is_linux) {
1927    sources -= [ "file_version_info_unittest.cc" ]
1928    sources += [ "nix/xdg_util_unittest.cc" ]
1929
1930    deps += [ "//base/test:malloc_wrapper" ]
1931
1932    if (use_glib) {
1933      configs += [ "//build/config/linux:glib" ]
1934    }
1935
1936    if (!is_component_build) {
1937      # Set rpath to find libmalloc_wrapper.so even in a non-component build.
1938      configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
1939    }
1940  }
1941
1942  if (is_linux || is_android) {
1943    sources += [ "trace_event/process_memory_maps_dump_provider_unittest.cc" ]
1944  }
1945
1946  if (!is_linux || use_ozone) {
1947    sources -= [ "message_loop/message_pump_glib_unittest.cc" ]
1948  }
1949
1950  if (is_posix && !is_ios) {
1951    sources += [ "message_loop/message_pump_libevent_unittest.cc" ]
1952    deps += [ "//base/third_party/libevent" ]
1953  }
1954
1955  if (is_android) {
1956    deps += [ "//testing/android/native_test:native_test_native_code" ]
1957    set_sources_assignment_filter([])
1958    sources += [
1959      "debug/proc_maps_linux_unittest.cc",
1960      "trace_event/trace_event_android_unittest.cc",
1961    ]
1962    set_sources_assignment_filter(sources_assignment_filter)
1963  }
1964
1965  if (is_win && target_cpu == "x64") {
1966    sources += [ "profiler/win32_stack_frame_unwinder_unittest.cc" ]
1967    deps += [ ":base_profiler_test_support_library" ]
1968  }
1969
1970  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1971  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1972
1973  # Symbols for crashes when running tests on swarming.
1974  if (symbol_level > 0) {
1975    if (is_win) {
1976      data += [ "$root_out_dir/base_unittests.exe.pdb" ]
1977    } else if (is_mac) {
1978      data += [ "$root_out_dir/base_unittests.dSYM/" ]
1979    }
1980  }
1981}
1982
1983if (enable_nocompile_tests) {
1984  nocompile_test("base_nocompile_tests") {
1985    sources = [
1986      "bind_unittest.nc",
1987      "callback_list_unittest.nc",
1988      "callback_unittest.nc",
1989      "memory/scoped_ptr_unittest.nc",
1990      "memory/weak_ptr_unittest.nc",
1991    ]
1992
1993    deps = [
1994      ":base",
1995      "//base/test:run_all_unittests",
1996      "//testing/gtest",
1997    ]
1998  }
1999}
2000
2001if (is_android) {
2002  # GYP: //base.gyp:base_jni_headers
2003  generate_jni("base_jni_headers") {
2004    sources = [
2005      "android/java/src/org/chromium/base/AnimationFrameTimeHistogram.java",
2006      "android/java/src/org/chromium/base/ApkAssets.java",
2007      "android/java/src/org/chromium/base/ApplicationStatus.java",
2008      "android/java/src/org/chromium/base/BuildInfo.java",
2009      "android/java/src/org/chromium/base/CommandLine.java",
2010      "android/java/src/org/chromium/base/ContentUriUtils.java",
2011      "android/java/src/org/chromium/base/ContextUtils.java",
2012      "android/java/src/org/chromium/base/CpuFeatures.java",
2013      "android/java/src/org/chromium/base/EventLog.java",
2014      "android/java/src/org/chromium/base/FieldTrialList.java",
2015      "android/java/src/org/chromium/base/ImportantFileWriterAndroid.java",
2016      "android/java/src/org/chromium/base/JNIUtils.java",
2017      "android/java/src/org/chromium/base/JavaHandlerThread.java",
2018      "android/java/src/org/chromium/base/LocaleUtils.java",
2019      "android/java/src/org/chromium/base/MemoryPressureListener.java",
2020      "android/java/src/org/chromium/base/PathService.java",
2021      "android/java/src/org/chromium/base/PathUtils.java",
2022      "android/java/src/org/chromium/base/PowerMonitor.java",
2023      "android/java/src/org/chromium/base/SysUtils.java",
2024      "android/java/src/org/chromium/base/SystemMessageHandler.java",
2025      "android/java/src/org/chromium/base/ThreadUtils.java",
2026      "android/java/src/org/chromium/base/TraceEvent.java",
2027      "android/java/src/org/chromium/base/library_loader/LibraryLoader.java",
2028      "android/java/src/org/chromium/base/metrics/RecordHistogram.java",
2029      "android/java/src/org/chromium/base/metrics/RecordUserAction.java",
2030    ]
2031
2032    public_deps = [
2033      ":android_runtime_jni_headers",
2034    ]
2035
2036    jni_package = "base"
2037  }
2038
2039  # GYP: //base.gyp:android_runtime_jni_headers
2040  generate_jar_jni("android_runtime_jni_headers") {
2041    jni_package = "base"
2042    classes = [ "java/lang/Runtime.class" ]
2043  }
2044
2045  # GYP: //base.gyp:base_java
2046  android_library("base_java") {
2047    srcjar_deps = [
2048      ":base_android_java_enums_srcjar",
2049      ":base_multidex_gen",
2050      ":base_native_libraries_gen",
2051    ]
2052
2053    deps = [
2054      "//third_party/android_tools:android_support_multidex_java",
2055      "//third_party/jsr-305:jsr_305_javalib",
2056    ]
2057
2058    DEPRECATED_java_in_dir = "android/java/src"
2059
2060    # A new version of NativeLibraries.java (with the actual correct values)
2061    # will be created when creating an apk.
2062    jar_excluded_patterns = [
2063      "*/NativeLibraries.class",
2064      "*/NativeLibraries##*.class",
2065    ]
2066  }
2067
2068  # GYP: //base.gyp:base_javatests
2069  android_library("base_javatests") {
2070    deps = [
2071      ":base_java",
2072      ":base_java_test_support",
2073    ]
2074    DEPRECATED_java_in_dir = "android/javatests/src"
2075  }
2076
2077  # GYP: //base.gyp:base_java_test_support
2078  android_library("base_java_test_support") {
2079    deps = [
2080      ":base_java",
2081      "//testing/android/reporter:reporter_java",
2082    ]
2083    DEPRECATED_java_in_dir = "test/android/javatests/src"
2084  }
2085
2086  # TODO(jbudorick): Remove this once we roll to robolectric 3.0 and pull
2087  # in the multidex shadow library. crbug.com/522043
2088  # GYP: //base.gyp:base_junit_test_support
2089  java_library("base_junit_test_support") {
2090    testonly = true
2091    java_files = [ "test/android/junit/src/org/chromium/base/test/shadows/ShadowMultiDex.java" ]
2092    deps = [
2093      "//third_party/android_tools:android_support_multidex_java",
2094      "//third_party/robolectric:android-all-4.3_r2-robolectric-0",
2095      "//third_party/robolectric:robolectric_java",
2096    ]
2097  }
2098
2099  # GYP: //base.gyp:base_junit_tests
2100  junit_binary("base_junit_tests") {
2101    java_files = [
2102      "android/junit/src/org/chromium/base/BaseChromiumApplicationTest.java",
2103      "android/junit/src/org/chromium/base/LogTest.java",
2104      "test/android/junit/src/org/chromium/base/test/util/DisableIfTest.java",
2105    ]
2106    deps = [
2107      ":base_java",
2108      ":base_java_test_support",
2109      ":base_junit_test_support",
2110    ]
2111  }
2112
2113  # GYP: //base.gyp:base_java_application_state
2114  # GYP: //base.gyp:base_java_library_load_from_apk_status_codes
2115  # GYP: //base.gyp:base_java_library_process_type
2116  # GYP: //base.gyp:base_java_memory_pressure_level
2117  java_cpp_enum("base_android_java_enums_srcjar") {
2118    sources = [
2119      "android/application_status_listener.h",
2120      "android/library_loader/library_load_from_apk_status_codes.h",
2121      "android/library_loader/library_loader_hooks.h",
2122      "memory/memory_pressure_listener.h",
2123    ]
2124  }
2125
2126  # GYP: //base/base.gyp:base_multidex_gen
2127  java_cpp_template("base_multidex_gen") {
2128    sources = [
2129      "android/java/templates/ChromiumMultiDex.template",
2130    ]
2131    if (is_debug) {
2132      defines = [ "MULTIDEX_CONFIGURATION_Debug" ]
2133    }
2134    package_name = "org/chromium/base/multidex"
2135  }
2136
2137  # GYP: //base/base.gyp:base_native_libraries_gen
2138  java_cpp_template("base_native_libraries_gen") {
2139    sources = [
2140      "android/java/templates/NativeLibraries.template",
2141    ]
2142    package_name = "org/chromium/base/library_loader"
2143  }
2144
2145  # GYP: //base.gyp:base_java_unittest_support
2146  android_library("base_java_unittest_support") {
2147    deps = [
2148      ":base_java",
2149    ]
2150    java_files =
2151        [ "test/android/java/src/org/chromium/base/ContentUriTestUtils.java" ]
2152  }
2153}
2154