Upload upstream chromium 69.0.3497
[platform/framework/web/chromium-efl.git] / base / BUILD.gn
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, prefer 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
20 import("//build/buildflag_header.gni")
21 import("//build/config/allocator.gni")
22 import("//build/config/arm.gni")
23 import("//build/config/c++/c++.gni")
24 import("//build/config/chromecast_build.gni")
25 import("//build/config/compiler/compiler.gni")
26 import("//build/config/dcheck_always_on.gni")
27 import("//build/config/jumbo.gni")
28 import("//build/config/nacl/config.gni")
29 import("//build/config/sysroot.gni")
30 import("//build/config/ui.gni")
31 import("//build/nocompile.gni")
32 import("//testing/libfuzzer/fuzzer_test.gni")
33 import("//testing/test.gni")
34 if (use_efl) {
35   import("//tizen_src/chromium_impl/base/base_efl.gni")
36 }
37
38 declare_args() {
39   # Override this value to give a specific build date.
40   # See //base/build_time.cc and //build/write_build_date_header.py for more
41   # details and the expected format.
42   override_build_date = "N/A"
43
44   # Indicates if the Location object contains the source code information
45   # (file, function, line). False means only the program counter (and currently
46   # file name) is saved.
47   enable_location_source = true
48
49   # Unsafe developer build. Has developer-friendly features that may weaken or
50   # disable security measures like sandboxing or ASLR.
51   # IMPORTANT: Unsafe developer builds should never be distributed to end users.
52   is_unsafe_developer_build = !is_official_build
53
54   # Set to true to disable COM init check hooks.
55   com_init_check_hook_disabled = false
56
57   # Set to true to enable mutex priority inheritance. See the comments in
58   # LockImpl::PriorityInheritanceAvailable() in lock_impl_posix.cc for the
59   # platform requirements to safely enable priority inheritance.
60   enable_mutex_priority_inheritance = false
61 }
62
63 # Determines whether libevent should be dep.
64 dep_libevent = !is_fuchsia && !is_win && !(is_nacl && !is_nacl_nonsfi) && !is_tizen
65
66 # Determines whether message_pump_libevent should be used.
67 use_libevent = dep_libevent && !is_ios
68
69 if (is_android) {
70   import("//build/config/android/rules.gni")
71 }
72
73 if (is_fuchsia) {
74   import("//build/config/fuchsia/fidl_library.gni")
75 }
76
77 config("base_flags") {
78   if (is_clang) {
79     cflags = [
80       # Don't die on dtoa code that uses a char as an array index.
81       # This is required solely for base/third_party/dmg_fp/dtoa_wrapper.cc.
82       "-Wno-char-subscripts",
83
84       # Ideally all product code (but no test code) in chrome would have these
85       # flags. But this isn't trivial so start with //base as a minimum
86       # requirement.
87       # https://groups.google.com/a/chromium.org/d/topic/chromium-dev/B9Q5KTD7iCo/discussion
88       "-Wglobal-constructors",
89       "-Wexit-time-destructors",
90     ]
91   }
92 }
93
94 config("base_implementation") {
95   defines = [ "BASE_IMPLEMENTATION" ]
96   configs = [ "//build/config/compiler:wexit_time_destructors" ]
97 }
98
99 if (is_win) {
100   # This is in a separate config so the flags can be applied to dependents.
101   # ldflags in GN aren't automatically inherited.
102   config("base_win_linker_flags") {
103     ldflags = [
104       "/DELAYLOAD:cfgmgr32.dll",
105       "/DELAYLOAD:powrprof.dll",
106       "/DELAYLOAD:setupapi.dll",
107     ]
108   }
109 }
110
111 if (is_nacl_nonsfi) {
112   # Must be in a config because of how GN orders flags (otherwise -Wall will
113   # appear after this, and turn it back on).
114   config("nacl_nonsfi_warnings") {
115     # file_util_posix.cc contains a function which is not
116     # being used by nacl_helper_nonsfi.
117     cflags = [ "-Wno-unused-function" ]
118   }
119 }
120
121 if (is_android) {
122   config("android_system_libs") {
123     libs = [
124       "android",
125       "log",  # Used by logging.cc.
126     ]
127   }
128 }
129
130 # Base and everything it depends on should be a static library rather than
131 # a source set. Base is more of a "library" in the classic sense in that many
132 # small parts of it are used in many different contexts. This combined with a
133 # few static initializers floating around means that dead code stripping
134 # still leaves a lot of code behind that isn't always used. For example, this
135 # saves more than 40K for a smaller target like chrome_elf.
136 #
137 # Use static libraries for the helper stuff as well like //base/debug since
138 # those things refer back to base code, which will force base compilation units
139 # to be linked in where they wouldn't have otherwise. This does not include
140 # test code (test support and anything in the test directory) which should use
141 # source_set as is recommended for GN targets).
142 jumbo_component("base") {
143   if (is_nacl_nonsfi) {
144     # TODO(phosek) bug 570839: If field_trial.cc is in a static library,
145     # nacl_helper_nonsfi doesn't link properly on Linux in debug builds. The
146     # reasons for this seem to involve obscure toolchain bugs. This should be
147     # fixed and this target should always be a static_library in the
148     # non-component case.
149     static_component_type = "source_set"
150   }
151   if (is_nacl || is_ios) {
152     # Link errors related to malloc functions if libbase for nacl is
153     # compiled with jumbo: https://crbug.com/775959.
154     # Same for ios: https://crbug.com/776313.
155     never_build_jumbo = true
156   }
157
158   sources = [
159     "allocator/allocator_check.cc",
160     "allocator/allocator_check.h",
161     "allocator/allocator_extension.cc",
162     "allocator/allocator_extension.h",
163     "allocator/allocator_interception_mac.h",
164     "allocator/allocator_interception_mac.mm",
165     "allocator/allocator_shim.h",
166     "allocator/malloc_zone_functions_mac.cc",
167     "allocator/malloc_zone_functions_mac.h",
168     "android/android_hardware_buffer_abi.h",
169     "android/android_hardware_buffer_compat.cc",
170     "android/android_hardware_buffer_compat.h",
171     "android/android_image_reader_abi.h",
172     "android/android_image_reader_compat.cc",
173     "android/android_image_reader_compat.h",
174     "android/animation_frame_time_histogram.cc",
175     "android/apk_assets.cc",
176     "android/apk_assets.h",
177     "android/application_status_listener.cc",
178     "android/application_status_listener.h",
179     "android/base_jni_onload.cc",
180     "android/base_jni_onload.h",
181     "android/build_info.cc",
182     "android/build_info.h",
183     "android/callback_android.cc",
184     "android/callback_android.h",
185     "android/child_process_binding_types.h",
186     "android/child_process_service.cc",
187     "android/command_line_android.cc",
188     "android/content_uri_utils.cc",
189     "android/content_uri_utils.h",
190     "android/cpu_features.cc",
191     "android/early_trace_event_binding.cc",
192     "android/event_log.cc",
193     "android/event_log.h",
194     "android/field_trial_list.cc",
195     "android/important_file_writer_android.cc",
196     "android/java_exception_reporter.cc",
197     "android/java_exception_reporter.h",
198     "android/java_handler_thread.cc",
199     "android/java_handler_thread.h",
200     "android/java_runtime.cc",
201     "android/java_runtime.h",
202     "android/jni_android.cc",
203     "android/jni_android.h",
204     "android/jni_array.cc",
205     "android/jni_array.h",
206     "android/jni_generator/jni_generator_helper.h",
207     "android/jni_int_wrapper.h",
208     "android/jni_registrar.cc",
209     "android/jni_registrar.h",
210     "android/jni_string.cc",
211     "android/jni_string.h",
212     "android/jni_utils.cc",
213     "android/jni_utils.h",
214     "android/jni_weak_ref.cc",
215     "android/jni_weak_ref.h",
216     "android/library_loader/anchor_functions.cc",
217     "android/library_loader/anchor_functions.h",
218     "android/library_loader/library_load_from_apk_status_codes.h",
219     "android/library_loader/library_loader_hooks.cc",
220     "android/library_loader/library_loader_hooks.h",
221     "android/library_loader/library_prefetcher.cc",
222     "android/library_loader/library_prefetcher.h",
223     "android/locale_utils.cc",
224     "android/locale_utils.h",
225     "android/memory_pressure_listener_android.cc",
226     "android/memory_pressure_listener_android.h",
227     "android/path_service_android.cc",
228     "android/path_utils.cc",
229     "android/path_utils.h",
230     "android/record_histogram.cc",
231     "android/record_user_action.cc",
232     "android/scoped_hardware_buffer_handle.cc",
233     "android/scoped_hardware_buffer_handle.h",
234     "android/scoped_java_ref.cc",
235     "android/scoped_java_ref.h",
236     "android/statistics_recorder_android.cc",
237     "android/sys_utils.cc",
238     "android/sys_utils.h",
239     "android/throw_uncaught_exception.cc",
240     "android/throw_uncaught_exception.h",
241     "android/time_utils.cc",
242     "android/timezone_utils.cc",
243     "android/timezone_utils.h",
244     "android/trace_event_binding.cc",
245     "android/unguessable_token_android.cc",
246     "android/unguessable_token_android.h",
247     "at_exit.cc",
248     "at_exit.h",
249     "atomic_ref_count.h",
250     "atomic_sequence_num.h",
251     "atomicops.h",
252     "atomicops_internals_atomicword_compat.h",
253     "atomicops_internals_portable.h",
254     "atomicops_internals_x86_msvc.h",
255     "auto_reset.h",
256     "barrier_closure.cc",
257     "barrier_closure.h",
258     "base64.cc",
259     "base64.h",
260     "base64url.cc",
261     "base64url.h",
262     "base_export.h",
263     "base_switches.h",
264     "big_endian.cc",
265     "big_endian.h",
266     "bind.h",
267     "bind_helpers.h",
268     "bind_internal.h",
269     "bit_cast.h",
270     "bits.h",
271     "build_time.cc",
272     "build_time.h",
273     "callback.h",
274     "callback_forward.h",
275     "callback_helpers.cc",
276     "callback_helpers.h",
277     "callback_internal.cc",
278     "callback_internal.h",
279     "callback_list.h",
280     "cancelable_callback.h",
281     "command_line.cc",
282     "command_line.h",
283     "compiler_specific.h",
284     "component_export.h",
285     "containers/adapters.h",
286     "containers/circular_deque.h",
287     "containers/flat_map.h",
288     "containers/flat_set.h",
289     "containers/flat_tree.h",
290     "containers/hash_tables.h",
291     "containers/id_map.h",
292     "containers/linked_list.h",
293     "containers/mru_cache.h",
294     "containers/small_map.h",
295     "containers/span.h",
296     "containers/stack.h",
297     "containers/stack_container.h",
298     "containers/unique_ptr_adapters.h",
299     "containers/vector_buffer.h",
300     "cpu.cc",
301     "cpu.h",
302     "critical_closure.h",
303     "critical_closure_internal_ios.mm",
304
305     # This file depends on files from the "debug/allocator" target,
306     # but this target does not depend on "debug/allocator".
307     "debug/activity_analyzer.cc",
308     "debug/activity_analyzer.h",
309     "debug/activity_tracker.cc",
310     "debug/activity_tracker.h",
311     "debug/alias.cc",
312     "debug/alias.h",
313     "debug/asan_invalid_access.cc",
314     "debug/asan_invalid_access.h",
315     "debug/close_handle_hook_win.cc",
316     "debug/close_handle_hook_win.h",
317     "debug/crash_logging.cc",
318     "debug/crash_logging.h",
319     "debug/debugger.cc",
320     "debug/debugger.h",
321     "debug/debugger_win.cc",
322     "debug/dump_without_crashing.cc",
323     "debug/dump_without_crashing.h",
324     "debug/gdi_debug_util_win.cc",
325     "debug/gdi_debug_util_win.h",
326     "debug/leak_annotations.h",
327     "debug/leak_tracker.h",
328     "debug/proc_maps_linux.cc",
329     "debug/proc_maps_linux.h",
330     "debug/profiler.cc",
331     "debug/profiler.h",
332     "debug/stack_trace.cc",
333     "debug/stack_trace.h",
334     "debug/stack_trace_android.cc",
335     "debug/stack_trace_win.cc",
336     "debug/task_annotator.cc",
337     "debug/task_annotator.h",
338     "debug/thread_heap_usage_tracker.cc",
339     "debug/thread_heap_usage_tracker.h",
340     "deferred_sequenced_task_runner.cc",
341     "deferred_sequenced_task_runner.h",
342     "environment.cc",
343     "environment.h",
344     "export_template.h",
345     "feature_list.cc",
346     "feature_list.h",
347     "file_descriptor_store.cc",
348     "file_descriptor_store.h",
349     "file_version_info.h",
350     "file_version_info_mac.h",
351     "file_version_info_mac.mm",
352     "file_version_info_win.cc",
353     "file_version_info_win.h",
354     "files/dir_reader_fallback.h",
355     "files/dir_reader_linux.h",
356     "files/file.cc",
357     "files/file.h",
358     "files/file_enumerator.cc",
359     "files/file_enumerator.h",
360     "files/file_enumerator_win.cc",
361     "files/file_path.cc",
362     "files/file_path.h",
363     "files/file_path_constants.cc",
364     "files/file_path_watcher.cc",
365     "files/file_path_watcher.h",
366     "files/file_path_watcher_fsevents.cc",
367     "files/file_path_watcher_fsevents.h",
368     "files/file_path_watcher_kqueue.cc",
369     "files/file_path_watcher_kqueue.h",
370     "files/file_path_watcher_linux.cc",
371     "files/file_path_watcher_mac.cc",
372     "files/file_path_watcher_win.cc",
373     "files/file_proxy.cc",
374     "files/file_proxy.h",
375     "files/file_tracing.cc",
376     "files/file_tracing.h",
377     "files/file_util.cc",
378     "files/file_util.h",
379     "files/file_util_android.cc",
380     "files/file_util_linux.cc",
381     "files/file_util_mac.mm",
382     "files/file_util_win.cc",
383     "files/file_win.cc",
384     "files/important_file_writer.cc",
385     "files/important_file_writer.h",
386     "files/memory_mapped_file.cc",
387     "files/memory_mapped_file.h",
388     "files/memory_mapped_file_win.cc",
389     "files/platform_file.h",
390     "files/scoped_file.cc",
391     "files/scoped_file.h",
392     "files/scoped_temp_dir.cc",
393     "files/scoped_temp_dir.h",
394     "format_macros.h",
395     "gtest_prod_util.h",
396     "guid.cc",
397     "guid.h",
398     "hash.cc",
399     "hash.h",
400     "ios/block_types.h",
401     "ios/crb_protocol_observers.h",
402     "ios/crb_protocol_observers.mm",
403     "ios/device_util.h",
404     "ios/device_util.mm",
405     "ios/ios_util.h",
406     "ios/ios_util.mm",
407     "ios/ns_error_util.h",
408     "ios/ns_error_util.mm",
409     "ios/scoped_critical_action.h",
410     "ios/scoped_critical_action.mm",
411     "ios/weak_nsobject.h",
412     "ios/weak_nsobject.mm",
413     "json/json_file_value_serializer.cc",
414     "json/json_file_value_serializer.h",
415     "json/json_parser.cc",
416     "json/json_parser.h",
417     "json/json_reader.cc",
418     "json/json_reader.h",
419     "json/json_string_value_serializer.cc",
420     "json/json_string_value_serializer.h",
421     "json/json_value_converter.cc",
422     "json/json_value_converter.h",
423     "json/json_writer.cc",
424     "json/json_writer.h",
425     "json/string_escape.cc",
426     "json/string_escape.h",
427     "lazy_instance.h",
428     "lazy_instance_helpers.cc",
429     "lazy_instance_helpers.h",
430     "linux_util.cc",
431     "linux_util.h",
432     "location.cc",
433     "location.h",
434     "logging.cc",
435     "logging.h",
436     "logging_win.cc",
437     "logging_win.h",
438     "mac/authorization_util.h",
439     "mac/authorization_util.mm",
440     "mac/availability.h",
441     "mac/bundle_locations.h",
442     "mac/bundle_locations.mm",
443     "mac/call_with_eh_frame.cc",
444     "mac/call_with_eh_frame.h",
445     "mac/call_with_eh_frame_asm.S",
446     "mac/close_nocancel.cc",
447     "mac/dispatch_source_mach.cc",
448     "mac/dispatch_source_mach.h",
449     "mac/foundation_util.h",
450     "mac/foundation_util.mm",
451     "mac/launch_services_util.h",
452     "mac/launch_services_util.mm",
453     "mac/launchd.cc",
454     "mac/launchd.h",
455     "mac/mac_logging.h",
456     "mac/mac_logging.mm",
457     "mac/mac_util.h",
458     "mac/mac_util.mm",
459     "mac/mach_logging.cc",
460     "mac/mach_logging.h",
461     "mac/mach_port_broker.h",
462     "mac/mach_port_broker.mm",
463     "mac/mach_port_util.cc",
464     "mac/mach_port_util.h",
465     "mac/objc_release_properties.h",
466     "mac/objc_release_properties.mm",
467     "mac/os_crash_dumps.cc",
468     "mac/os_crash_dumps.h",
469     "mac/scoped_aedesc.h",
470     "mac/scoped_authorizationref.h",
471     "mac/scoped_block.h",
472     "mac/scoped_cffiledescriptorref.h",
473     "mac/scoped_cftyperef.h",
474     "mac/scoped_dispatch_object.h",
475     "mac/scoped_ionotificationportref.h",
476     "mac/scoped_ioobject.h",
477     "mac/scoped_ioplugininterface.h",
478     "mac/scoped_launch_data.h",
479     "mac/scoped_mach_port.cc",
480     "mac/scoped_mach_port.h",
481     "mac/scoped_mach_vm.cc",
482     "mac/scoped_mach_vm.h",
483     "mac/scoped_nsautorelease_pool.h",
484     "mac/scoped_nsautorelease_pool.mm",
485     "mac/scoped_nsobject.h",
486     "mac/scoped_nsobject.mm",
487     "mac/scoped_objc_class_swizzler.h",
488     "mac/scoped_objc_class_swizzler.mm",
489     "mac/scoped_sending_event.h",
490     "mac/scoped_sending_event.mm",
491     "mac/sdk_forward_declarations.h",
492     "mac/sdk_forward_declarations.mm",
493     "macros.h",
494     "md5.cc",
495     "md5.h",
496     "memory/aligned_memory.cc",
497     "memory/aligned_memory.h",
498     "memory/discardable_memory.cc",
499     "memory/discardable_memory.h",
500     "memory/discardable_memory_allocator.cc",
501     "memory/discardable_memory_allocator.h",
502     "memory/discardable_shared_memory.cc",
503     "memory/discardable_shared_memory.h",
504     "memory/free_deleter.h",
505     "memory/linked_ptr.h",
506     "memory/memory_coordinator_client.cc",
507     "memory/memory_coordinator_client.h",
508     "memory/memory_coordinator_client_registry.cc",
509     "memory/memory_coordinator_client_registry.h",
510     "memory/memory_coordinator_proxy.cc",
511     "memory/memory_coordinator_proxy.h",
512     "memory/memory_pressure_listener.cc",
513     "memory/memory_pressure_listener.h",
514     "memory/memory_pressure_monitor.cc",
515     "memory/memory_pressure_monitor.h",
516     "memory/memory_pressure_monitor_chromeos.cc",
517     "memory/memory_pressure_monitor_chromeos.h",
518     "memory/memory_pressure_monitor_mac.cc",
519     "memory/memory_pressure_monitor_mac.h",
520     "memory/memory_pressure_monitor_win.cc",
521     "memory/memory_pressure_monitor_win.h",
522     "memory/platform_shared_memory_region.cc",
523     "memory/platform_shared_memory_region.h",
524     "memory/protected_memory.cc",
525     "memory/protected_memory.h",
526     "memory/protected_memory_cfi.h",
527     "memory/protected_memory_win.cc",
528     "memory/ptr_util.h",
529     "memory/raw_scoped_refptr_mismatch_checker.h",
530     "memory/read_only_shared_memory_region.cc",
531     "memory/read_only_shared_memory_region.h",
532     "memory/ref_counted.cc",
533     "memory/ref_counted.h",
534     "memory/ref_counted_delete_on_sequence.h",
535     "memory/ref_counted_memory.cc",
536     "memory/ref_counted_memory.h",
537     "memory/scoped_policy.h",
538     "memory/scoped_refptr.h",
539     "memory/shared_memory.h",
540     "memory/shared_memory_handle.cc",
541     "memory/shared_memory_handle.h",
542     "memory/shared_memory_helper.cc",
543     "memory/shared_memory_helper.h",
544     "memory/shared_memory_mapping.cc",
545     "memory/shared_memory_mapping.h",
546     "memory/shared_memory_tracker.cc",
547     "memory/shared_memory_tracker.h",
548     "memory/singleton.h",
549     "memory/unsafe_shared_memory_region.cc",
550     "memory/unsafe_shared_memory_region.h",
551     "memory/weak_ptr.cc",
552     "memory/weak_ptr.h",
553     "memory/writable_shared_memory_region.cc",
554     "memory/writable_shared_memory_region.h",
555     "message_loop/incoming_task_queue.cc",
556     "message_loop/incoming_task_queue.h",
557     "message_loop/message_loop.cc",
558     "message_loop/message_loop.h",
559     "message_loop/message_loop_current.cc",
560     "message_loop/message_loop_current.h",
561     "message_loop/message_loop_task_runner.cc",
562     "message_loop/message_loop_task_runner.h",
563     "message_loop/message_pump.cc",
564     "message_loop/message_pump.h",
565     "message_loop/message_pump_android.cc",
566     "message_loop/message_pump_android.h",
567     "message_loop/message_pump_default.cc",
568     "message_loop/message_pump_default.h",
569     "message_loop/message_pump_for_io.h",
570     "message_loop/message_pump_for_ui.h",
571     "message_loop/message_pump_glib.cc",
572     "message_loop/message_pump_glib.h",
573     "message_loop/message_pump_io_ios.cc",
574     "message_loop/message_pump_io_ios.h",
575     "message_loop/message_pump_mac.h",
576     "message_loop/message_pump_mac.mm",
577     "message_loop/message_pump_win.cc",
578     "message_loop/message_pump_win.h",
579     "message_loop/timer_slack.h",
580     "metrics/bucket_ranges.cc",
581     "metrics/bucket_ranges.h",
582     "metrics/dummy_histogram.cc",
583     "metrics/dummy_histogram.h",
584     "metrics/field_trial.cc",
585     "metrics/field_trial.h",
586     "metrics/field_trial_param_associator.cc",
587     "metrics/field_trial_param_associator.h",
588     "metrics/field_trial_params.cc",
589     "metrics/field_trial_params.h",
590     "metrics/histogram.cc",
591     "metrics/histogram.h",
592     "metrics/histogram_base.cc",
593     "metrics/histogram_base.h",
594     "metrics/histogram_delta_serialization.cc",
595     "metrics/histogram_delta_serialization.h",
596     "metrics/histogram_flattener.h",
597     "metrics/histogram_functions.cc",
598     "metrics/histogram_functions.h",
599     "metrics/histogram_macros.h",
600     "metrics/histogram_macros_internal.h",
601     "metrics/histogram_macros_local.h",
602     "metrics/histogram_samples.cc",
603     "metrics/histogram_samples.h",
604     "metrics/histogram_snapshot_manager.cc",
605     "metrics/histogram_snapshot_manager.h",
606     "metrics/metrics_hashes.cc",
607     "metrics/metrics_hashes.h",
608     "metrics/persistent_histogram_allocator.cc",
609     "metrics/persistent_histogram_allocator.h",
610     "metrics/persistent_memory_allocator.cc",
611     "metrics/persistent_memory_allocator.h",
612     "metrics/persistent_sample_map.cc",
613     "metrics/persistent_sample_map.h",
614     "metrics/record_histogram_checker.h",
615     "metrics/sample_map.cc",
616     "metrics/sample_map.h",
617     "metrics/sample_vector.cc",
618     "metrics/sample_vector.h",
619     "metrics/single_sample_metrics.cc",
620     "metrics/single_sample_metrics.h",
621     "metrics/sparse_histogram.cc",
622     "metrics/sparse_histogram.h",
623     "metrics/statistics_recorder.cc",
624     "metrics/statistics_recorder.h",
625     "metrics/user_metrics.cc",
626     "metrics/user_metrics.h",
627     "metrics/user_metrics_action.h",
628     "native_library.cc",
629     "native_library.h",
630     "native_library_ios.mm",
631     "native_library_mac.mm",
632     "native_library_win.cc",
633     "nix/mime_util_xdg.cc",
634     "nix/mime_util_xdg.h",
635     "nix/xdg_util.cc",
636     "nix/xdg_util.h",
637     "no_destructor.h",
638     "observer_list.h",
639     "observer_list_threadsafe.cc",
640     "observer_list_threadsafe.h",
641     "optional.h",
642     "os_compat_android.cc",
643     "os_compat_android.h",
644     "os_compat_nacl.cc",
645     "os_compat_nacl.h",
646     "path_service.cc",
647     "path_service.h",
648     "pending_task.cc",
649     "pending_task.h",
650     "pickle.cc",
651     "pickle.h",
652     "post_task_and_reply_with_result_internal.h",
653     "power_monitor/power_monitor.cc",
654     "power_monitor/power_monitor.h",
655     "power_monitor/power_monitor_device_source.cc",
656     "power_monitor/power_monitor_device_source.h",
657     "power_monitor/power_monitor_source.cc",
658     "power_monitor/power_monitor_source.h",
659     "power_monitor/power_observer.h",
660     "process/internal_linux.cc",
661     "process/internal_linux.h",
662     "process/kill.cc",
663     "process/kill.h",
664     "process/kill_mac.cc",
665     "process/kill_win.cc",
666     "process/launch.cc",
667     "process/launch.h",
668     "process/launch_ios.cc",
669     "process/launch_mac.cc",
670     "process/launch_win.cc",
671     "process/memory.cc",
672     "process/memory.h",
673     "process/memory_linux.cc",
674     "process/memory_mac.mm",
675     "process/memory_win.cc",
676     "process/port_provider_mac.cc",
677     "process/port_provider_mac.h",
678     "process/process.h",
679     "process/process_handle.cc",
680     "process/process_handle.h",
681
682     #"process/process_handle_freebsd.cc",  # Unused in Chromium build.
683     "process/process_handle_linux.cc",
684     "process/process_handle_mac.cc",
685
686     #"process/process_handle_openbsd.cc",  # Unused in Chromium build.
687     "process/process_handle_win.cc",
688     "process/process_info.h",
689     "process/process_info_linux.cc",
690     "process/process_info_mac.cc",
691     "process/process_info_win.cc",
692     "process/process_iterator.cc",
693     "process/process_iterator.h",
694
695     #"process/process_iterator_freebsd.cc",  # Unused in Chromium build.
696     "process/process_iterator_linux.cc",
697     "process/process_iterator_mac.cc",
698
699     #"process/process_iterator_openbsd.cc",  # Unused in Chromium build.
700     "process/process_iterator_win.cc",
701     "process/process_linux.cc",
702     "process/process_mac.cc",
703     "process/process_metrics.cc",
704     "process/process_metrics.h",
705
706     #"process/process_metrics_freebsd.cc",  # Unused in Chromium build.
707     "process/process_metrics_ios.cc",
708     "process/process_metrics_linux.cc",
709     "process/process_metrics_mac.cc",
710
711     #"process/process_metrics_openbsd.cc",  # Unused in Chromium build.
712     "process/process_metrics_win.cc",
713     "process/process_win.cc",
714     "profiler/native_stack_sampler.cc",
715     "profiler/native_stack_sampler.h",
716     "profiler/native_stack_sampler_mac.cc",
717     "profiler/native_stack_sampler_win.cc",
718     "profiler/stack_sampling_profiler.cc",
719     "profiler/stack_sampling_profiler.h",
720     "rand_util.cc",
721     "rand_util.h",
722     "rand_util_nacl.cc",
723     "rand_util_win.cc",
724     "run_loop.cc",
725     "run_loop.h",
726     "sampling_heap_profiler/lock_free_address_hash_set.cc",
727     "sampling_heap_profiler/lock_free_address_hash_set.h",
728     "sampling_heap_profiler/sampling_heap_profiler.cc",
729     "sampling_heap_profiler/sampling_heap_profiler.h",
730     "scoped_clear_errno.h",
731     "scoped_generic.h",
732     "scoped_native_library.cc",
733     "scoped_native_library.h",
734     "scoped_observer.h",
735     "sequence_checker.h",
736     "sequence_checker_impl.cc",
737     "sequence_checker_impl.h",
738     "sequence_token.cc",
739     "sequence_token.h",
740     "sequenced_task_runner.cc",
741     "sequenced_task_runner.h",
742     "sequenced_task_runner_helpers.h",
743     "sha1.cc",
744     "sha1.h",
745     "single_thread_task_runner.h",
746     "stl_util.h",
747     "strings/char_traits.h",
748     "strings/latin1_string_conversions.cc",
749     "strings/latin1_string_conversions.h",
750     "strings/nullable_string16.cc",
751     "strings/nullable_string16.h",
752     "strings/pattern.cc",
753     "strings/pattern.h",
754     "strings/safe_sprintf.cc",
755     "strings/safe_sprintf.h",
756     "strings/strcat.cc",
757     "strings/strcat.h",
758     "strings/string16.cc",
759     "strings/string16.h",
760     "strings/string_number_conversions.cc",
761     "strings/string_number_conversions.h",
762     "strings/string_piece.cc",
763     "strings/string_piece.h",
764     "strings/string_piece_forward.h",
765     "strings/string_split.cc",
766     "strings/string_split.h",
767     "strings/string_tokenizer.h",
768     "strings/string_util.cc",
769     "strings/string_util.h",
770     "strings/string_util_constants.cc",
771     "strings/string_util_win.h",
772     "strings/stringize_macros.h",
773     "strings/stringprintf.cc",
774     "strings/stringprintf.h",
775     "strings/sys_string_conversions.h",
776     "strings/sys_string_conversions_mac.mm",
777     "strings/sys_string_conversions_win.cc",
778     "strings/utf_offset_string_conversions.cc",
779     "strings/utf_offset_string_conversions.h",
780     "strings/utf_string_conversion_utils.cc",
781     "strings/utf_string_conversion_utils.h",
782     "strings/utf_string_conversions.cc",
783     "strings/utf_string_conversions.h",
784     "supports_user_data.cc",
785     "supports_user_data.h",
786     "sync_socket.h",
787     "sync_socket_win.cc",
788     "synchronization/atomic_flag.cc",
789     "synchronization/atomic_flag.h",
790     "synchronization/cancellation_flag.h",
791     "synchronization/condition_variable.h",
792     "synchronization/condition_variable_win.cc",
793     "synchronization/lock.cc",
794     "synchronization/lock.h",
795     "synchronization/lock_impl.h",
796     "synchronization/lock_impl_win.cc",
797     "synchronization/spin_wait.h",
798     "synchronization/waitable_event.h",
799     "synchronization/waitable_event_mac.cc",
800     "synchronization/waitable_event_watcher.h",
801     "synchronization/waitable_event_watcher_mac.cc",
802     "synchronization/waitable_event_watcher_win.cc",
803     "synchronization/waitable_event_win.cc",
804     "sys_byteorder.h",
805     "sys_info.cc",
806     "sys_info.h",
807     "sys_info_android.cc",
808     "sys_info_chromeos.cc",
809     "sys_info_internal.h",
810     "syslog_logging.cc",
811     "syslog_logging.h",
812
813     #"sys_info_freebsd.cc",  # Unused in Chromium build.
814     "sys_info_ios.mm",
815     "sys_info_linux.cc",
816     "sys_info_mac.mm",
817
818     #"sys_info_openbsd.cc",  # Unused in Chromium build.
819     "sys_info_win.cc",
820     "system_monitor/system_monitor.cc",
821     "system_monitor/system_monitor.h",
822     "task/cancelable_task_tracker.cc",
823     "task/cancelable_task_tracker.h",
824     "task/sequence_manager/enqueue_order.cc",
825     "task/sequence_manager/enqueue_order.h",
826     "task/sequence_manager/graceful_queue_shutdown_helper.cc",
827     "task/sequence_manager/graceful_queue_shutdown_helper.h",
828     "task/sequence_manager/intrusive_heap.h",
829     "task/sequence_manager/lazily_deallocated_deque.h",
830     "task/sequence_manager/lazy_now.cc",
831     "task/sequence_manager/lazy_now.h",
832     "task/sequence_manager/real_time_domain.cc",
833     "task/sequence_manager/real_time_domain.h",
834     "task/sequence_manager/sequence_manager.cc",
835     "task/sequence_manager/sequence_manager.h",
836     "task/sequence_manager/sequence_manager_impl.cc",
837     "task/sequence_manager/sequence_manager_impl.h",
838     "task/sequence_manager/sequenced_task_source.h",
839     "task/sequence_manager/task_queue.cc",
840     "task/sequence_manager/task_queue.h",
841     "task/sequence_manager/task_queue_impl.cc",
842     "task/sequence_manager/task_queue_impl.h",
843     "task/sequence_manager/task_queue_selector.cc",
844     "task/sequence_manager/task_queue_selector.h",
845     "task/sequence_manager/task_queue_selector_logic.h",
846     "task/sequence_manager/task_time_observer.h",
847     "task/sequence_manager/thread_controller.h",
848     "task/sequence_manager/thread_controller_impl.cc",
849     "task/sequence_manager/thread_controller_impl.h",
850     "task/sequence_manager/thread_controller_with_message_pump_impl.cc",
851     "task/sequence_manager/thread_controller_with_message_pump_impl.h",
852     "task/sequence_manager/time_domain.cc",
853     "task/sequence_manager/time_domain.h",
854     "task/sequence_manager/work_queue.cc",
855     "task/sequence_manager/work_queue.h",
856     "task/sequence_manager/work_queue_sets.cc",
857     "task/sequence_manager/work_queue_sets.h",
858     "task_runner.cc",
859     "task_runner.h",
860     "task_runner_util.h",
861     "task_scheduler/can_schedule_sequence_observer.h",
862     "task_scheduler/delayed_task_manager.cc",
863     "task_scheduler/delayed_task_manager.h",
864     "task_scheduler/environment_config.cc",
865     "task_scheduler/environment_config.h",
866     "task_scheduler/initialization_util.cc",
867     "task_scheduler/initialization_util.h",
868     "task_scheduler/lazy_task_runner.cc",
869     "task_scheduler/lazy_task_runner.h",
870     "task_scheduler/platform_native_worker_pool_win.cc",
871     "task_scheduler/platform_native_worker_pool_win.h",
872     "task_scheduler/post_task.cc",
873     "task_scheduler/post_task.h",
874     "task_scheduler/priority_queue.cc",
875     "task_scheduler/priority_queue.h",
876     "task_scheduler/scheduler_lock.h",
877     "task_scheduler/scheduler_lock_impl.cc",
878     "task_scheduler/scheduler_lock_impl.h",
879     "task_scheduler/scheduler_single_thread_task_runner_manager.cc",
880     "task_scheduler/scheduler_single_thread_task_runner_manager.h",
881     "task_scheduler/scheduler_worker.cc",
882     "task_scheduler/scheduler_worker.h",
883     "task_scheduler/scheduler_worker_observer.h",
884     "task_scheduler/scheduler_worker_params.h",
885     "task_scheduler/scheduler_worker_pool.cc",
886     "task_scheduler/scheduler_worker_pool.h",
887     "task_scheduler/scheduler_worker_pool_impl.cc",
888     "task_scheduler/scheduler_worker_pool_impl.h",
889     "task_scheduler/scheduler_worker_pool_params.cc",
890     "task_scheduler/scheduler_worker_pool_params.h",
891     "task_scheduler/scheduler_worker_stack.cc",
892     "task_scheduler/scheduler_worker_stack.h",
893     "task_scheduler/scoped_set_task_priority_for_current_thread.cc",
894     "task_scheduler/scoped_set_task_priority_for_current_thread.h",
895     "task_scheduler/sequence.cc",
896     "task_scheduler/sequence.h",
897     "task_scheduler/sequence_sort_key.cc",
898     "task_scheduler/sequence_sort_key.h",
899     "task_scheduler/service_thread.cc",
900     "task_scheduler/service_thread.h",
901     "task_scheduler/single_thread_task_runner_thread_mode.h",
902     "task_scheduler/task.cc",
903     "task_scheduler/task.h",
904     "task_scheduler/task_scheduler.cc",
905     "task_scheduler/task_scheduler.h",
906     "task_scheduler/task_scheduler_impl.cc",
907     "task_scheduler/task_scheduler_impl.h",
908     "task_scheduler/task_tracker.cc",
909     "task_scheduler/task_tracker.h",
910     "task_scheduler/task_traits.cc",
911     "task_scheduler/task_traits.h",
912     "task_scheduler/task_traits_details.h",
913     "task_scheduler/tracked_ref.h",
914     "template_util.h",
915     "test/malloc_wrapper.h",
916     "third_party/dmg_fp/dmg_fp.h",
917     "third_party/dmg_fp/dtoa_wrapper.cc",
918     "third_party/dmg_fp/g_fmt.cc",
919     "third_party/icu/icu_utf.cc",
920     "third_party/icu/icu_utf.h",
921     "third_party/nspr/prtime.cc",
922     "third_party/nspr/prtime.h",
923     "third_party/superfasthash/superfasthash.c",
924     "thread_annotations.h",
925     "threading/platform_thread.h",
926     "threading/platform_thread_android.cc",
927     "threading/platform_thread_linux.cc",
928     "threading/platform_thread_mac.mm",
929     "threading/platform_thread_win.cc",
930     "threading/post_task_and_reply_impl.cc",
931     "threading/post_task_and_reply_impl.h",
932     "threading/scoped_blocking_call.cc",
933     "threading/scoped_blocking_call.h",
934     "threading/sequence_local_storage_map.cc",
935     "threading/sequence_local_storage_map.h",
936     "threading/sequence_local_storage_slot.cc",
937     "threading/sequence_local_storage_slot.h",
938     "threading/sequenced_task_runner_handle.cc",
939     "threading/sequenced_task_runner_handle.h",
940     "threading/simple_thread.cc",
941     "threading/simple_thread.h",
942     "threading/thread.cc",
943     "threading/thread.h",
944     "threading/thread_checker.h",
945     "threading/thread_checker_impl.cc",
946     "threading/thread_checker_impl.h",
947     "threading/thread_collision_warner.cc",
948     "threading/thread_collision_warner.h",
949     "threading/thread_id_name_manager.cc",
950     "threading/thread_id_name_manager.h",
951     "threading/thread_local.h",
952     "threading/thread_local_storage.cc",
953     "threading/thread_local_storage.h",
954     "threading/thread_local_storage_win.cc",
955     "threading/thread_restrictions.cc",
956     "threading/thread_restrictions.h",
957     "threading/thread_task_runner_handle.cc",
958     "threading/thread_task_runner_handle.h",
959     "threading/watchdog.cc",
960     "threading/watchdog.h",
961     "time/clock.cc",
962     "time/clock.h",
963     "time/default_clock.cc",
964     "time/default_clock.h",
965     "time/default_tick_clock.cc",
966     "time/default_tick_clock.h",
967     "time/tick_clock.cc",
968     "time/tick_clock.h",
969     "time/time.cc",
970     "time/time.h",
971     "time/time_override.cc",
972     "time/time_override.h",
973     "time/time_to_iso8601.cc",
974     "time/time_to_iso8601.h",
975     "timer/elapsed_timer.cc",
976     "timer/elapsed_timer.h",
977     "timer/hi_res_timer_manager.h",
978     "timer/hi_res_timer_manager_win.cc",
979     "timer/timer.cc",
980     "timer/timer.h",
981     "trace_event/auto_open_close_event.cc",
982     "trace_event/auto_open_close_event.h",
983     "trace_event/blame_context.cc",
984     "trace_event/blame_context.h",
985     "trace_event/category_registry.cc",
986     "trace_event/category_registry.h",
987     "trace_event/common/trace_event_common.h",
988     "trace_event/event_name_filter.cc",
989     "trace_event/event_name_filter.h",
990     "trace_event/heap_profiler.h",
991     "trace_event/heap_profiler_allocation_context.cc",
992     "trace_event/heap_profiler_allocation_context.h",
993     "trace_event/heap_profiler_allocation_context_tracker.cc",
994     "trace_event/heap_profiler_allocation_context_tracker.h",
995     "trace_event/heap_profiler_event_filter.cc",
996     "trace_event/heap_profiler_event_filter.h",
997     "trace_event/java_heap_dump_provider_android.cc",
998     "trace_event/java_heap_dump_provider_android.h",
999     "trace_event/malloc_dump_provider.cc",
1000     "trace_event/malloc_dump_provider.h",
1001     "trace_event/memory_allocator_dump.cc",
1002     "trace_event/memory_allocator_dump.h",
1003     "trace_event/memory_allocator_dump_guid.cc",
1004     "trace_event/memory_allocator_dump_guid.h",
1005     "trace_event/memory_dump_manager.cc",
1006     "trace_event/memory_dump_manager.h",
1007     "trace_event/memory_dump_manager_test_utils.h",
1008     "trace_event/memory_dump_provider.h",
1009     "trace_event/memory_dump_provider_info.cc",
1010     "trace_event/memory_dump_provider_info.h",
1011     "trace_event/memory_dump_request_args.cc",
1012     "trace_event/memory_dump_request_args.h",
1013     "trace_event/memory_dump_scheduler.cc",
1014     "trace_event/memory_dump_scheduler.h",
1015     "trace_event/memory_infra_background_whitelist.cc",
1016     "trace_event/memory_infra_background_whitelist.h",
1017     "trace_event/memory_usage_estimator.cc",
1018     "trace_event/memory_usage_estimator.h",
1019     "trace_event/process_memory_dump.cc",
1020     "trace_event/process_memory_dump.h",
1021     "trace_event/trace_buffer.cc",
1022     "trace_event/trace_buffer.h",
1023     "trace_event/trace_category.h",
1024     "trace_event/trace_config.cc",
1025     "trace_event/trace_config.h",
1026     "trace_event/trace_config_category_filter.cc",
1027     "trace_event/trace_config_category_filter.h",
1028     "trace_event/trace_event.h",
1029     "trace_event/trace_event_android.cc",
1030     "trace_event/trace_event_argument.cc",
1031     "trace_event/trace_event_argument.h",
1032     "trace_event/trace_event_etw_export_win.cc",
1033     "trace_event/trace_event_etw_export_win.h",
1034     "trace_event/trace_event_filter.cc",
1035     "trace_event/trace_event_filter.h",
1036     "trace_event/trace_event_impl.cc",
1037     "trace_event/trace_event_impl.h",
1038     "trace_event/trace_event_memory_overhead.cc",
1039     "trace_event/trace_event_memory_overhead.h",
1040     "trace_event/trace_event_system_stats_monitor.cc",
1041     "trace_event/trace_event_system_stats_monitor.h",
1042     "trace_event/trace_log.cc",
1043     "trace_event/trace_log.h",
1044     "trace_event/trace_log_constants.cc",
1045     "trace_event/tracing_agent.cc",
1046     "trace_event/tracing_agent.h",
1047     "tuple.h",
1048     "unguessable_token.cc",
1049     "unguessable_token.h",
1050     "value_conversions.cc",
1051     "value_conversions.h",
1052     "value_iterators.cc",
1053     "value_iterators.h",
1054     "values.cc",
1055     "values.h",
1056     "version.cc",
1057     "version.h",
1058     "vlog.cc",
1059     "vlog.h",
1060     "win/async_operation.h",
1061     "win/com_init_check_hook.cc",
1062     "win/com_init_check_hook.h",
1063     "win/com_init_util.cc",
1064     "win/com_init_util.h",
1065     "win/core_winrt_util.cc",
1066     "win/core_winrt_util.h",
1067     "win/current_module.h",
1068     "win/enum_variant.cc",
1069     "win/enum_variant.h",
1070     "win/event_trace_consumer.h",
1071     "win/event_trace_controller.cc",
1072     "win/event_trace_controller.h",
1073     "win/event_trace_provider.cc",
1074     "win/event_trace_provider.h",
1075     "win/i18n.cc",
1076     "win/i18n.h",
1077     "win/iat_patch_function.cc",
1078     "win/iat_patch_function.h",
1079     "win/iunknown_impl.cc",
1080     "win/iunknown_impl.h",
1081     "win/message_window.cc",
1082     "win/message_window.h",
1083     "win/object_watcher.cc",
1084     "win/object_watcher.h",
1085     "win/patch_util.cc",
1086     "win/patch_util.h",
1087     "win/process_startup_helper.cc",
1088     "win/process_startup_helper.h",
1089     "win/reference.h",
1090     "win/registry.cc",
1091     "win/registry.h",
1092     "win/resource_util.cc",
1093     "win/resource_util.h",
1094     "win/scoped_bstr.cc",
1095     "win/scoped_bstr.h",
1096     "win/scoped_co_mem.h",
1097     "win/scoped_com_initializer.cc",
1098     "win/scoped_com_initializer.h",
1099     "win/scoped_gdi_object.h",
1100     "win/scoped_handle.cc",
1101     "win/scoped_handle.h",
1102     "win/scoped_handle_verifier.cc",
1103     "win/scoped_handle_verifier.h",
1104     "win/scoped_hdc.h",
1105     "win/scoped_hglobal.h",
1106     "win/scoped_hstring.cc",
1107     "win/scoped_hstring.h",
1108     "win/scoped_process_information.cc",
1109     "win/scoped_process_information.h",
1110     "win/scoped_propvariant.h",
1111     "win/scoped_select_object.h",
1112     "win/scoped_variant.cc",
1113     "win/scoped_variant.h",
1114     "win/scoped_windows_thread_environment.h",
1115     "win/scoped_winrt_initializer.cc",
1116     "win/scoped_winrt_initializer.h",
1117     "win/shortcut.cc",
1118     "win/shortcut.h",
1119     "win/startup_information.cc",
1120     "win/startup_information.h",
1121     "win/typed_event_handler.h",
1122     "win/vector.cc",
1123     "win/vector.h",
1124     "win/wait_chain.cc",
1125     "win/wait_chain.h",
1126     "win/win_util.cc",
1127     "win/win_util.h",
1128     "win/windows_version.cc",
1129     "win/windows_version.h",
1130     "win/winrt_storage_util.cc",
1131     "win/winrt_storage_util.h",
1132     "win/wrapped_window_proc.cc",
1133     "win/wrapped_window_proc.h",
1134   ]
1135
1136   if (use_efl) {
1137     sources += external_base_sources
1138   }
1139
1140   if (is_tizen) {
1141     libs = [
1142       "event",
1143       "dlog",
1144     ]
1145   }
1146
1147   # winternl.h and NTSecAPI.h have different definitions of UNICODE_STRING.
1148   # There's only one client of NTSecAPI.h in base but several of winternl.h,
1149   # so exclude the NTSecAPI.h one.
1150   if (is_win) {
1151     jumbo_excluded_sources = [ "rand_util_win.cc" ]
1152   }
1153
1154   if (is_posix) {
1155     sources += [
1156       "base_paths_posix.h",
1157       "debug/debugger_posix.cc",
1158       "debug/stack_trace_posix.cc",
1159       "file_descriptor_posix.h",
1160       "files/dir_reader_posix.h",
1161       "files/file_descriptor_watcher_posix.cc",
1162       "files/file_descriptor_watcher_posix.h",
1163       "files/file_enumerator_posix.cc",
1164       "files/file_posix.cc",
1165       "files/file_util_posix.cc",
1166       "files/memory_mapped_file_posix.cc",
1167       "memory/protected_memory_posix.cc",
1168       "message_loop/watchable_io_message_pump_posix.cc",
1169       "message_loop/watchable_io_message_pump_posix.h",
1170       "native_library_posix.cc",
1171       "posix/eintr_wrapper.h",
1172       "posix/file_descriptor_shuffle.cc",
1173       "posix/file_descriptor_shuffle.h",
1174       "posix/global_descriptors.cc",
1175       "posix/global_descriptors.h",
1176       "posix/safe_strerror.cc",
1177       "posix/safe_strerror.h",
1178       "posix/unix_domain_socket.cc",
1179       "posix/unix_domain_socket.h",
1180       "process/kill_posix.cc",
1181       "process/launch_posix.cc",
1182       "process/process_handle_posix.cc",
1183       "process/process_metrics_posix.cc",
1184       "process/process_posix.cc",
1185       "profiler/native_stack_sampler_posix.cc",
1186       "rand_util_posix.cc",
1187       "strings/string_util_posix.h",
1188       "strings/sys_string_conversions_posix.cc",
1189       "sync_socket_posix.cc",
1190       "synchronization/condition_variable_posix.cc",
1191       "synchronization/lock_impl_posix.cc",
1192       "synchronization/waitable_event_posix.cc",
1193       "synchronization/waitable_event_watcher_posix.cc",
1194       "sys_info_posix.cc",
1195       "task_scheduler/task_tracker_posix.cc",
1196       "task_scheduler/task_tracker_posix.h",
1197       "threading/platform_thread_internal_posix.cc",
1198       "threading/platform_thread_internal_posix.h",
1199       "threading/platform_thread_posix.cc",
1200       "threading/thread_local_storage_posix.cc",
1201       "timer/hi_res_timer_manager_posix.cc",
1202     ]
1203   }
1204
1205   if (!is_nacl) {
1206     sources += [
1207       "base_paths.cc",
1208       "base_paths.h",
1209       "base_paths_android.cc",
1210       "base_paths_android.h",
1211       "base_paths_mac.h",
1212       "base_paths_mac.mm",
1213       "base_paths_posix.h",
1214       "base_paths_win.cc",
1215       "base_paths_win.h",
1216       "metrics/persistent_histogram_storage.cc",
1217       "metrics/persistent_histogram_storage.h",
1218     ]
1219
1220     if (is_linux || is_tizen) {
1221       sources += [
1222         "base_paths_posix.cc",
1223         "debug/elf_reader_linux.cc",
1224         "debug/elf_reader_linux.h",
1225       ]
1226     }
1227   }
1228
1229   all_dependent_configs = []
1230   defines = []
1231   data = []
1232   data_deps = []
1233   libs = []
1234
1235   configs += [
1236     ":base_flags",
1237     ":base_implementation",
1238     "//build/config:precompiled_headers",
1239     "//build/config/compiler:noshadowing",
1240   ]
1241
1242   deps = [
1243     "//base/allocator",
1244     "//base/allocator:buildflags",
1245     "//base/third_party/dynamic_annotations",
1246     "//third_party/modp_b64",
1247   ]
1248
1249   public_deps = [
1250     ":anchor_functions_buildflags",
1251     ":base_static",
1252     ":build_date",
1253     ":cfi_buildflags",
1254     ":debugging_buildflags",
1255     ":orderfile_buildflags",
1256     ":partition_alloc_buildflags",
1257     ":protected_memory_buildflags",
1258     ":synchronization_buildflags",
1259     "//base/numerics:base_numerics",
1260   ]
1261
1262   # Needed for <atomic> if using newer C++ library than sysroot, except if
1263   # building inside the cros_sdk environment - use host_toolchain as a
1264   # more robust check for this.
1265   if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) &&
1266       host_toolchain != "//build/toolchain/cros:host") {
1267     libs += [ "atomic" ]
1268   }
1269
1270   if (use_allocator_shim) {
1271     sources += [
1272       "allocator/allocator_shim.cc",
1273       "allocator/allocator_shim.h",
1274       "allocator/allocator_shim_internals.h",
1275       "allocator/allocator_shim_override_cpp_symbols.h",
1276       "allocator/allocator_shim_override_libc_symbols.h",
1277     ]
1278     if (is_win) {
1279       sources += [
1280         "allocator/allocator_shim_default_dispatch_to_winheap.cc",
1281         "allocator/allocator_shim_override_ucrt_symbols_win.h",
1282         "allocator/winheap_stubs_win.cc",
1283         "allocator/winheap_stubs_win.h",
1284       ]
1285     } else if (is_linux && use_allocator == "tcmalloc") {
1286       sources += [
1287         "allocator/allocator_shim_default_dispatch_to_tcmalloc.cc",
1288         "allocator/allocator_shim_override_glibc_weak_symbols.h",
1289       ]
1290       deps += [ "//base/allocator:tcmalloc" ]
1291     } else if (is_linux && use_allocator == "none") {
1292       sources += [ "allocator/allocator_shim_default_dispatch_to_glibc.cc" ]
1293     } else if (is_android && use_allocator == "none") {
1294       sources += [
1295         "allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
1296         "allocator/allocator_shim_override_linker_wrapped_symbols.h",
1297       ]
1298       all_dependent_configs += [ "//base/allocator:wrap_malloc_symbols" ]
1299     } else if (is_mac) {
1300       sources += [
1301         "allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.cc",
1302         "allocator/allocator_shim_default_dispatch_to_mac_zoned_malloc.h",
1303         "allocator/allocator_shim_override_mac_symbols.h",
1304       ]
1305     }
1306   }
1307
1308   # Allow more direct string conversions on platforms with native utf8
1309   # strings
1310   if (is_mac || is_ios || is_chromeos || is_chromecast || is_fuchsia) {
1311     defines += [ "SYSTEM_NATIVE_UTF8" ]
1312   }
1313
1314   # Android.
1315   if (is_android) {
1316     sources -= [ "debug/stack_trace_posix.cc" ]
1317     sources += [
1318       "memory/platform_shared_memory_region_android.cc",
1319       "memory/shared_memory_android.cc",
1320       "memory/shared_memory_handle_android.cc",
1321       "time/time_android.cc",
1322     ]
1323
1324     # Android uses some Linux sources, put those back.
1325     set_sources_assignment_filter([])
1326     sources += [
1327       "debug/elf_reader_linux.cc",
1328       "debug/elf_reader_linux.h",
1329       "debug/proc_maps_linux.cc",
1330       "debug/proc_maps_linux.h",
1331       "files/file_path_watcher_linux.cc",
1332       "power_monitor/power_monitor_device_source_android.cc",
1333       "process/internal_linux.cc",
1334       "process/internal_linux.h",
1335       "process/memory_linux.cc",
1336       "process/process_handle_linux.cc",
1337       "process/process_info_linux.cc",
1338       "process/process_iterator_linux.cc",
1339       "process/process_metrics_linux.cc",
1340       "sys_info_linux.cc",
1341     ]
1342     set_sources_assignment_filter(sources_assignment_filter)
1343
1344     deps += [
1345       ":base_jni_headers",
1346       "//third_party/android_tools:cpu_features",
1347       "//third_party/ashmem",
1348     ]
1349
1350     # TODO(thomasanderson): Remove this once use_custom_libcxx is always set to
1351     # true on Android.
1352     if (!use_custom_libcxx) {
1353       deps += [ "//buildtools/third_party/libc++abi:cxa_demangle_stub" ]
1354     }
1355
1356     # Needs to be a public config so that dependent targets link against it as
1357     # well when doing a component build.
1358     public_configs = [ ":android_system_libs" ]
1359
1360     if (can_unwind_with_cfi_table) {
1361       sources += [
1362         "trace_event/cfi_backtrace_android.cc",
1363         "trace_event/cfi_backtrace_android.h",
1364       ]
1365     }
1366
1367     # This is actually a linker script, but it can be added to the link in the
1368     # same way as a library.
1369     libs += [ "android/library_loader/anchor_functions.lds" ]
1370   }
1371
1372   # Chromeos.
1373   if (is_chromeos) {
1374     sources += [ "power_monitor/power_monitor_device_source_chromeos.cc" ]
1375   }
1376
1377   # Fuchsia.
1378   if (is_fuchsia) {
1379     sources += [
1380       "base_paths_fuchsia.cc",
1381       "base_paths_fuchsia.h",
1382       "debug/debugger_posix.cc",
1383       "debug/stack_trace_fuchsia.cc",
1384       "file_descriptor_posix.h",
1385       "files/dir_reader_posix.h",
1386       "files/file_descriptor_watcher_posix.cc",
1387       "files/file_descriptor_watcher_posix.h",
1388       "files/file_enumerator_posix.cc",
1389       "files/file_path_watcher_fuchsia.cc",
1390       "files/file_posix.cc",
1391       "files/file_util_posix.cc",
1392       "files/memory_mapped_file_posix.cc",
1393       "fuchsia/async_dispatcher.cc",
1394       "fuchsia/async_dispatcher.h",
1395       "fuchsia/component_context.cc",
1396       "fuchsia/component_context.h",
1397       "fuchsia/default_job.cc",
1398       "fuchsia/default_job.h",
1399       "fuchsia/fidl_interface_request.cc",
1400       "fuchsia/fidl_interface_request.h",
1401       "fuchsia/file_utils.cc",
1402       "fuchsia/file_utils.h",
1403       "fuchsia/filtered_service_directory.cc",
1404       "fuchsia/filtered_service_directory.h",
1405       "fuchsia/fuchsia_logging.cc",
1406       "fuchsia/fuchsia_logging.h",
1407       "fuchsia/scoped_zx_handle.h",
1408       "fuchsia/service_directory.cc",
1409       "fuchsia/service_directory.h",
1410       "memory/platform_shared_memory_region_fuchsia.cc",
1411       "memory/protected_memory_posix.cc",
1412       "memory/shared_memory_fuchsia.cc",
1413       "memory/shared_memory_handle_fuchsia.cc",
1414       "message_loop/message_pump_fuchsia.cc",
1415       "message_loop/message_pump_fuchsia.h",
1416       "message_loop/watchable_io_message_pump_posix.cc",
1417       "message_loop/watchable_io_message_pump_posix.h",
1418       "native_library_fuchsia.cc",
1419       "posix/eintr_wrapper.h",
1420       "posix/file_descriptor_shuffle.cc",
1421       "posix/file_descriptor_shuffle.h",
1422       "posix/global_descriptors.cc",
1423       "posix/global_descriptors.h",
1424       "posix/safe_strerror.cc",
1425       "posix/safe_strerror.h",
1426       "process/kill_fuchsia.cc",
1427       "process/launch_fuchsia.cc",
1428       "process/memory_fuchsia.cc",
1429       "process/process_fuchsia.cc",
1430       "process/process_handle_fuchsia.cc",
1431       "process/process_iterator_fuchsia.cc",
1432       "process/process_metrics_fuchsia.cc",
1433       "process/process_metrics_posix.cc",
1434       "profiler/native_stack_sampler_posix.cc",
1435       "rand_util_fuchsia.cc",
1436       "strings/string_util_posix.h",
1437       "strings/sys_string_conversions_posix.cc",
1438       "sync_socket_posix.cc",
1439       "synchronization/condition_variable_posix.cc",
1440       "synchronization/lock_impl_posix.cc",
1441       "synchronization/waitable_event_posix.cc",
1442       "synchronization/waitable_event_watcher_posix.cc",
1443       "sys_info_fuchsia.cc",
1444       "sys_info_posix.cc",
1445       "task_scheduler/task_tracker_posix.cc",
1446       "task_scheduler/task_tracker_posix.h",
1447       "threading/platform_thread_fuchsia.cc",
1448       "threading/platform_thread_posix.cc",
1449       "threading/thread_local_storage_posix.cc",
1450       "time/time_conversion_posix.cc",
1451       "time/time_exploded_posix.cc",
1452       "time/time_fuchsia.cc",
1453       "timer/hi_res_timer_manager_posix.cc",
1454     ]
1455
1456     # These only need to be public deps because of includes of their headers
1457     # by public //base headers, which requires they be on the include path.
1458     # TODO(https://crbug.com/841171): Move these back to |deps|.
1459     public_deps += [
1460       "//third_party/fuchsia-sdk:async",
1461       "//third_party/fuchsia-sdk:fdio",
1462       "//third_party/fuchsia-sdk:zx",
1463     ]
1464
1465     deps += [
1466       "//third_party/fuchsia-sdk:async_default",
1467       "//third_party/fuchsia-sdk:fidl",
1468       "//third_party/fuchsia-sdk:svc",
1469     ]
1470   }
1471
1472   # NaCl.
1473   if (is_nacl) {
1474     # We reset sources_assignment_filter in order to explicitly include
1475     # the linux file (which would otherwise be filtered out).
1476     set_sources_assignment_filter([])
1477     sources += [
1478       "files/file_path_watcher_stub.cc",
1479       "memory/shared_memory_nacl.cc",
1480       "process/process_metrics_nacl.cc",
1481       "sync_socket_nacl.cc",
1482       "threading/platform_thread_linux.cc",
1483     ]
1484     set_sources_assignment_filter(sources_assignment_filter)
1485
1486     sources -= [
1487       "cpu.cc",
1488       "debug/crash_logging.cc",
1489       "debug/crash_logging.h",
1490       "debug/stack_trace.cc",
1491       "debug/stack_trace_posix.cc",
1492       "files/file_enumerator_posix.cc",
1493       "files/file_proxy.cc",
1494       "files/important_file_writer.cc",
1495       "files/important_file_writer.h",
1496       "files/scoped_temp_dir.cc",
1497       "memory/discardable_memory.cc",
1498       "memory/discardable_memory.h",
1499       "memory/discardable_memory_allocator.cc",
1500       "memory/discardable_memory_allocator.h",
1501       "memory/discardable_shared_memory.cc",
1502       "memory/discardable_shared_memory.h",
1503       "memory/shared_memory_helper.cc",
1504       "memory/shared_memory_helper.h",
1505       "native_library.cc",
1506       "native_library_posix.cc",
1507       "path_service.cc",
1508       "process/kill.cc",
1509       "process/kill.h",
1510       "process/memory.cc",
1511       "process/memory.h",
1512       "process/process_iterator.cc",
1513       "process/process_iterator.h",
1514       "process/process_metrics.cc",
1515       "process/process_metrics_posix.cc",
1516       "process/process_posix.cc",
1517       "scoped_native_library.cc",
1518       "sync_socket_posix.cc",
1519       "sys_info.cc",
1520       "sys_info_posix.cc",
1521       "task_scheduler/initialization_util.cc",
1522       "task_scheduler/initialization_util.h",
1523       "trace_event/trace_event_system_stats_monitor.cc",
1524     ]
1525
1526     if (is_nacl_nonsfi) {
1527       sources -= [ "rand_util_nacl.cc" ]
1528       configs += [ ":nacl_nonsfi_warnings" ]
1529     } else {
1530       sources -= [
1531         "files/file_descriptor_watcher_posix.cc",
1532         "files/file_descriptor_watcher_posix.h",
1533         "files/file_util.cc",
1534         "files/file_util.h",
1535         "files/file_util_posix.cc",
1536         "json/json_file_value_serializer.cc",
1537         "json/json_file_value_serializer.h",
1538         "posix/unix_domain_socket.cc",
1539         "process/kill_posix.cc",
1540         "process/launch.cc",
1541         "process/launch.h",
1542         "process/launch_posix.cc",
1543         "rand_util_posix.cc",
1544         "task_scheduler/task_tracker_posix.cc",
1545         "task_scheduler/task_tracker_posix.h",
1546       ]
1547     }
1548   } else {
1549     # Remove NaCl stuff.
1550     sources -= [
1551       "os_compat_nacl.cc",
1552       "os_compat_nacl.h",
1553       "rand_util_nacl.cc",
1554     ]
1555
1556     if (use_partition_alloc) {
1557       # Add stuff that doesn't work in NaCl.
1558       sources += [
1559         # PartitionAlloc uses SpinLock, which doesn't work in NaCl (see below).
1560         "allocator/partition_allocator/address_space_randomization.cc",
1561         "allocator/partition_allocator/address_space_randomization.h",
1562         "allocator/partition_allocator/oom.h",
1563         "allocator/partition_allocator/page_allocator.cc",
1564         "allocator/partition_allocator/page_allocator.h",
1565         "allocator/partition_allocator/page_allocator_internal.h",
1566         "allocator/partition_allocator/partition_alloc.cc",
1567         "allocator/partition_allocator/partition_alloc.h",
1568         "allocator/partition_allocator/partition_alloc_constants.h",
1569         "allocator/partition_allocator/partition_bucket.cc",
1570         "allocator/partition_allocator/partition_bucket.h",
1571         "allocator/partition_allocator/partition_cookie.h",
1572         "allocator/partition_allocator/partition_direct_map_extent.h",
1573         "allocator/partition_allocator/partition_freelist_entry.h",
1574         "allocator/partition_allocator/partition_oom.cc",
1575         "allocator/partition_allocator/partition_oom.h",
1576         "allocator/partition_allocator/partition_page.cc",
1577         "allocator/partition_allocator/partition_page.h",
1578         "allocator/partition_allocator/partition_root_base.cc",
1579         "allocator/partition_allocator/partition_root_base.h",
1580         "allocator/partition_allocator/spin_lock.cc",
1581         "allocator/partition_allocator/spin_lock.h",
1582       ]
1583       if (is_win) {
1584         sources +=
1585             [ "allocator/partition_allocator/page_allocator_internals_win.h" ]
1586       } else if (is_posix || is_fuchsia) {
1587         sources +=
1588             [ "allocator/partition_allocator/page_allocator_internals_posix.h" ]
1589       }
1590     }
1591   }
1592
1593   # Windows.
1594   if (is_win) {
1595     sources += [
1596       "memory/platform_shared_memory_region_win.cc",
1597       "memory/shared_memory_handle_win.cc",
1598       "memory/shared_memory_win.cc",
1599       "power_monitor/power_monitor_device_source_win.cc",
1600       "profiler/win32_stack_frame_unwinder.cc",
1601       "profiler/win32_stack_frame_unwinder.h",
1602       "time/time_win.cc",
1603     ]
1604
1605     sources -= [
1606       "file_descriptor_store.cc",
1607       "file_descriptor_store.h",
1608       "memory/shared_memory_helper.cc",
1609       "memory/shared_memory_helper.h",
1610       "strings/string16.cc",
1611     ]
1612
1613     deps += [
1614       "//base/trace_event/etw_manifest:chrome_events_win",
1615       "//base/win:base_win_buildflags",
1616     ]
1617
1618     data_deps += [ "//build/win:runtime_libs" ]
1619
1620     if (com_init_check_hook_disabled) {
1621       defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
1622     }
1623
1624     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1625     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1626
1627     libs += [
1628       "cfgmgr32.lib",
1629       "powrprof.lib",
1630       "propsys.lib",
1631       "setupapi.lib",
1632       "userenv.lib",
1633       "winmm.lib",
1634     ]
1635     all_dependent_configs += [
1636       ":base_win_linker_flags",
1637       "//tools/win/DebugVisualizers:chrome",
1638     ]
1639   }
1640
1641   # Desktop Mac.
1642   if (is_mac) {
1643     sources -= [ "profiler/native_stack_sampler_posix.cc" ]
1644     sources += [
1645       "mac/scoped_typeref.h",
1646       "memory/platform_shared_memory_region_mac.cc",
1647       "memory/shared_memory_handle_mac.cc",
1648       "memory/shared_memory_mac.cc",
1649       "power_monitor/power_monitor_device_source_mac.mm",
1650       "time/time_conversion_posix.cc",
1651       "time/time_exploded_posix.cc",
1652       "time/time_mac.cc",
1653     ]
1654
1655     libs += [
1656       "ApplicationServices.framework",
1657       "AppKit.framework",
1658       "bsm",
1659       "CoreFoundation.framework",
1660       "IOKit.framework",
1661       "Security.framework",
1662     ]
1663   }
1664
1665   # Mac or iOS.
1666   if (is_mac || is_ios) {
1667     sources -= [
1668       "native_library_posix.cc",
1669       "strings/sys_string_conversions_posix.cc",
1670       "synchronization/waitable_event_posix.cc",
1671       "synchronization/waitable_event_watcher_posix.cc",
1672       "threading/platform_thread_internal_posix.cc",
1673     ]
1674   } else {
1675     # Non-Mac/ios.
1676     sources -= [
1677       "files/file_path_watcher_fsevents.cc",
1678       "files/file_path_watcher_fsevents.h",
1679       "files/file_path_watcher_kqueue.cc",
1680       "files/file_path_watcher_kqueue.h",
1681     ]
1682   }
1683
1684   # Linux.
1685   if (is_linux) {
1686     # TODO(brettw) this will need to be parameterized at some point.
1687     linux_configs = []
1688     if (use_glib) {
1689       linux_configs += [ "//build/config/linux:glib" ]
1690     }
1691
1692     defines += [ "USE_SYMBOLIZE" ]
1693
1694     configs += linux_configs
1695     all_dependent_configs += linux_configs
1696
1697     # These dependencies are not required on Android, and in the case
1698     # of xdg_mime must be excluded due to licensing restrictions.
1699     deps += [
1700       "//base/third_party/symbolize",
1701       "//base/third_party/xdg_mime",
1702       "//base/third_party/xdg_user_dirs",
1703     ]
1704   } else {
1705     # Non-Linux.
1706     if (is_tizen) {
1707       deps += [
1708         "//base/third_party/xdg_mime",
1709         "//base/third_party/xdg_user_dirs",
1710       ]
1711     }
1712     if (!is_tizen) {
1713       sources -= [
1714         "nix/mime_util_xdg.cc",
1715         "nix/mime_util_xdg.h",
1716         "nix/xdg_util.cc",
1717         "nix/xdg_util.h",
1718       ]
1719     }
1720     if (!is_android && !is_tizen) {
1721       sources -= [
1722         "linux_util.cc",
1723         "linux_util.h",
1724       ]
1725     }
1726   }
1727
1728   # iOS
1729   if (is_ios) {
1730     set_sources_assignment_filter([])
1731
1732     sources -= [
1733       "files/file_path_watcher.cc",
1734       "files/file_path_watcher.h",
1735       "files/file_path_watcher_fsevents.cc",
1736       "files/file_path_watcher_fsevents.h",
1737       "files/file_path_watcher_kqueue.cc",
1738       "files/file_path_watcher_kqueue.h",
1739       "memory/discardable_shared_memory.cc",
1740       "memory/discardable_shared_memory.h",
1741       "process/kill.cc",
1742       "process/kill.h",
1743       "process/kill_posix.cc",
1744       "process/launch.cc",
1745       "process/launch.h",
1746       "process/launch_posix.cc",
1747       "process/memory.cc",
1748       "process/memory.h",
1749       "process/process_iterator.cc",
1750       "process/process_iterator.h",
1751       "process/process_metrics_posix.cc",
1752       "process/process_posix.cc",
1753       "sync_socket.h",
1754       "sync_socket_posix.cc",
1755       "synchronization/waitable_event_watcher.h",
1756     ]
1757     sources += [
1758       "base_paths_mac.h",
1759       "base_paths_mac.mm",
1760       "file_version_info_mac.h",
1761       "file_version_info_mac.mm",
1762       "files/file_util_mac.mm",
1763       "mac/bundle_locations.h",
1764       "mac/bundle_locations.mm",
1765       "mac/call_with_eh_frame.cc",
1766       "mac/call_with_eh_frame.h",
1767       "mac/foundation_util.h",
1768       "mac/foundation_util.mm",
1769       "mac/mac_logging.h",
1770       "mac/mac_logging.mm",
1771       "mac/mach_logging.cc",
1772       "mac/mach_logging.h",
1773       "mac/objc_release_properties.h",
1774       "mac/objc_release_properties.mm",
1775       "mac/scoped_block.h",
1776       "mac/scoped_mach_port.cc",
1777       "mac/scoped_mach_port.h",
1778       "mac/scoped_mach_vm.cc",
1779       "mac/scoped_mach_vm.h",
1780       "mac/scoped_nsautorelease_pool.h",
1781       "mac/scoped_nsautorelease_pool.mm",
1782       "mac/scoped_nsobject.h",
1783       "mac/scoped_nsobject.mm",
1784       "mac/scoped_objc_class_swizzler.h",
1785       "mac/scoped_objc_class_swizzler.mm",
1786       "mac/scoped_typeref.h",
1787       "message_loop/message_pump_mac.h",
1788       "message_loop/message_pump_mac.mm",
1789       "power_monitor/power_monitor_device_source_ios.mm",
1790       "process/memory_stubs.cc",
1791       "strings/sys_string_conversions_mac.mm",
1792       "synchronization/waitable_event_mac.cc",
1793       "threading/platform_thread_mac.mm",
1794       "time/time_conversion_posix.cc",
1795       "time/time_mac.cc",
1796     ]
1797
1798     set_sources_assignment_filter(sources_assignment_filter)
1799   }
1800
1801   if (dep_libevent) {
1802     deps += [ "//base/third_party/libevent" ]
1803   }
1804
1805   if (use_libevent) {
1806     sources += [
1807       "message_loop/message_pump_libevent.cc",
1808       "message_loop/message_pump_libevent.h",
1809     ]
1810   }
1811
1812   # Android and MacOS have their own custom shared memory handle
1813   # implementations. e.g. due to supporting both POSIX and native handles.
1814   if (is_posix && !is_android && !is_mac) {
1815     sources += [
1816       "memory/platform_shared_memory_region_posix.cc",
1817       "memory/shared_memory_handle_posix.cc",
1818     ]
1819   }
1820
1821   if (is_posix && !is_mac && !is_nacl) {
1822     sources += [ "memory/shared_memory_posix.cc" ]
1823   }
1824
1825   if (is_posix && !is_mac && !is_ios) {
1826     sources += [
1827       "time/time_conversion_posix.cc",
1828       "time/time_exploded_posix.cc",
1829       "time/time_now_posix.cc",
1830     ]
1831   }
1832
1833   if ((is_posix && !is_mac && !is_ios && !is_android && !is_chromeos) ||
1834       is_fuchsia) {
1835     sources += [ "power_monitor/power_monitor_device_source_stub.cc" ]
1836   }
1837
1838   if (is_tizen) {
1839     set_sources_assignment_filter([])
1840     sources += [
1841       "files/file_path_watcher_linux.cc",
1842       "files/file_util_linux.cc",
1843       "process/internal_linux.cc",
1844       "process/internal_linux.h",
1845       "process/memory_linux.cc",
1846       "process/process_handle_linux.cc",
1847       "process/process_info_linux.cc",
1848       "process/process_iterator_linux.cc",
1849       "process/process_linux.cc",
1850       "process/process_metrics_linux.cc",
1851       "sys_info_linux.cc",
1852       "threading/platform_thread_linux.cc",
1853     ]
1854     set_sources_assignment_filter(sources_assignment_filter)
1855   }
1856
1857   if (!use_glib) {
1858     sources -= [
1859       "message_loop/message_pump_glib.cc",
1860       "message_loop/message_pump_glib.h",
1861     ]
1862   }
1863
1864   if (using_sanitizer) {
1865     data += [ "//tools/valgrind/asan/" ]
1866     if (is_win) {
1867       data +=
1868           [ "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer.exe" ]
1869     } else {
1870       data += [ "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer" ]
1871     }
1872   }
1873
1874   configs += [ "//build/config/compiler:wexit_time_destructors" ]
1875   if (!is_debug) {
1876     configs -= [ "//build/config/compiler:default_optimization" ]
1877     configs += [ "//build/config/compiler:optimize_max" ]
1878   }
1879 }
1880
1881 # Build flags for Control Flow Integrity
1882 # https://www.chromium.org/developers/testing/control-flow-integrity
1883 buildflag_header("cfi_buildflags") {
1884   header = "cfi_buildflags.h"
1885
1886   flags = [
1887     # TODO(pcc): remove CFI_CAST_CHECK, see https://crbug.com/626794.
1888     "CFI_CAST_CHECK=$is_cfi && $use_cfi_cast",
1889     "CFI_ICALL_CHECK=$is_cfi && $use_cfi_icall",
1890     "CFI_ENFORCEMENT_TRAP=$is_cfi && !$use_cfi_diag",
1891     "CFI_ENFORCEMENT_DIAGNOSTIC=$is_cfi && $use_cfi_diag && !$use_cfi_recover",
1892   ]
1893 }
1894
1895 buildflag_header("debugging_buildflags") {
1896   header = "debugging_buildflags.h"
1897   header_dir = "base/debug"
1898
1899   flags = [
1900     "ENABLE_LOCATION_SOURCE=$enable_location_source",
1901     "ENABLE_PROFILING=$enable_profiling",
1902     "CAN_UNWIND_WITH_FRAME_POINTERS=$can_unwind_with_frame_pointers",
1903     "UNSAFE_DEVELOPER_BUILD=$is_unsafe_developer_build",
1904     "CAN_UNWIND_WITH_CFI_TABLE=$can_unwind_with_cfi_table",
1905   ]
1906 }
1907
1908 buildflag_header("orderfile_buildflags") {
1909   header = "orderfile_buildflags.h"
1910   header_dir = "base/android/orderfile"
1911   using_order_profiling = is_android && use_order_profiling
1912   using_devtools_dumping = is_android && devtools_instrumentation_dumping
1913
1914   flags = [
1915     "DEVTOOLS_INSTRUMENTATION_DUMPING=$using_devtools_dumping",
1916     "ORDERFILE_INSTRUMENTATION=$using_order_profiling",
1917   ]
1918 }
1919
1920 # Build flags for ProtectedMemory, temporary workaround for crbug.com/792777
1921 # TODO(vtsyrklevich): Remove once support for gold on Android/CrOs is dropped
1922 buildflag_header("protected_memory_buildflags") {
1923   header = "protected_memory_buildflags.h"
1924   header_dir = "base/memory"
1925
1926   flags = [ "USE_LLD=$use_lld" ]
1927 }
1928
1929 buildflag_header("synchronization_buildflags") {
1930   header = "synchronization_buildflags.h"
1931   header_dir = "base/synchronization"
1932
1933   flags =
1934       [ "ENABLE_MUTEX_PRIORITY_INHERITANCE=$enable_mutex_priority_inheritance" ]
1935 }
1936
1937 buildflag_header("anchor_functions_buildflags") {
1938   header = "anchor_functions_buildflags.h"
1939   header_dir = "base/android/library_loader"
1940   _supports_code_ordering = current_cpu == "arm"
1941
1942   flags = [
1943     "USE_LLD=$use_lld",
1944     "SUPPORTS_CODE_ORDERING=$_supports_code_ordering",
1945   ]
1946 }
1947
1948 buildflag_header("partition_alloc_buildflags") {
1949   header = "partition_alloc_buildflags.h"
1950   header_dir = "base"
1951
1952   flags = [ "USE_PARTITION_ALLOC=$use_partition_alloc" ]
1953 }
1954
1955 # This is the subset of files from base that should not be used with a dynamic
1956 # library. Note that this library cannot depend on base because base depends on
1957 # base_static.
1958 static_library("base_static") {
1959   sources = [
1960     "base_switches.cc",
1961     "base_switches.h",
1962   ]
1963
1964   if (is_win) {
1965     public_deps = [
1966       "//base/win:pe_image",
1967     ]
1968
1969     # Disable sanitizer coverage in win/pe_image.cc. It is called by the sandbox
1970     # before sanitizer coverage can initialize. http://crbug.com/484711
1971     configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
1972     configs +=
1973         [ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
1974   }
1975
1976   if (!is_debug) {
1977     configs -= [ "//build/config/compiler:default_optimization" ]
1978     configs += [ "//build/config/compiler:optimize_max" ]
1979   }
1980 }
1981
1982 component("i18n") {
1983   output_name = "base_i18n"
1984   sources = [
1985     "i18n/base_i18n_export.h",
1986     "i18n/base_i18n_switches.cc",
1987     "i18n/base_i18n_switches.h",
1988     "i18n/bidi_line_iterator.cc",
1989     "i18n/bidi_line_iterator.h",
1990     "i18n/break_iterator.cc",
1991     "i18n/break_iterator.h",
1992     "i18n/case_conversion.cc",
1993     "i18n/case_conversion.h",
1994     "i18n/char_iterator.cc",
1995     "i18n/char_iterator.h",
1996     "i18n/character_encoding.cc",
1997     "i18n/character_encoding.h",
1998     "i18n/encoding_detection.cc",
1999     "i18n/encoding_detection.h",
2000     "i18n/file_util_icu.cc",
2001     "i18n/file_util_icu.h",
2002     "i18n/i18n_constants.cc",
2003     "i18n/i18n_constants.h",
2004     "i18n/icu_string_conversions.cc",
2005     "i18n/icu_string_conversions.h",
2006     "i18n/icu_util.cc",
2007     "i18n/icu_util.h",
2008     "i18n/message_formatter.cc",
2009     "i18n/message_formatter.h",
2010     "i18n/number_formatting.cc",
2011     "i18n/number_formatting.h",
2012     "i18n/rtl.cc",
2013     "i18n/rtl.h",
2014     "i18n/streaming_utf8_validator.cc",
2015     "i18n/streaming_utf8_validator.h",
2016     "i18n/string_compare.cc",
2017     "i18n/string_compare.h",
2018     "i18n/string_search.cc",
2019     "i18n/string_search.h",
2020     "i18n/time_formatting.cc",
2021     "i18n/time_formatting.h",
2022     "i18n/timezone.cc",
2023     "i18n/timezone.h",
2024     "i18n/unicodestring.h",
2025     "i18n/utf8_validator_tables.cc",
2026     "i18n/utf8_validator_tables.h",
2027   ]
2028   defines = [ "BASE_I18N_IMPLEMENTATION" ]
2029   configs += [ "//build/config/compiler:wexit_time_destructors" ]
2030   public_deps = [
2031     "//third_party/ced",
2032     "//third_party/icu",
2033   ]
2034   deps = [
2035     ":base",
2036     "//base/third_party/dynamic_annotations",
2037   ]
2038
2039   if (!is_debug) {
2040     configs -= [ "//build/config/compiler:default_optimization" ]
2041     configs += [ "//build/config/compiler:optimize_max" ]
2042   }
2043
2044   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
2045   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
2046
2047   if (is_mac) {
2048     libs = [ "CoreFoundation.framework" ]
2049   }
2050 }
2051
2052 test("base_perftests") {
2053   sources = [
2054     "message_loop/message_loop_perftest.cc",
2055     "message_loop/message_loop_task_runner_perftest.cc",
2056     "message_loop/message_pump_perftest.cc",
2057     "task/sequence_manager/sequence_manager_perftest.cc",
2058
2059     # "test/run_all_unittests.cc",
2060     "json/json_perftest.cc",
2061     "synchronization/waitable_event_perftest.cc",
2062     "threading/thread_perftest.cc",
2063   ]
2064   deps = [
2065     ":base",
2066     "//base/test:test_support",
2067     "//base/test:test_support_perf",
2068     "//testing/gtest",
2069     "//testing/perf",
2070   ]
2071
2072   if (is_android) {
2073     deps += [ "//testing/android/native_test:native_test_native_code" ]
2074   }
2075 }
2076
2077 test("base_i18n_perftests") {
2078   sources = [
2079     "i18n/streaming_utf8_validator_perftest.cc",
2080   ]
2081   deps = [
2082     ":base",
2083     ":i18n",
2084     "//base/test:test_support",
2085     "//base/test:test_support_perf",
2086     "//testing/gtest",
2087   ]
2088 }
2089
2090 if (!is_ios) {
2091   executable("build_utf8_validator_tables") {
2092     sources = [
2093       "i18n/build_utf8_validator_tables.cc",
2094     ]
2095     deps = [
2096       ":base",
2097       "//build/win:default_exe_manifest",
2098       "//third_party/icu:icuuc",
2099     ]
2100   }
2101
2102   executable("check_example") {
2103     sources = [
2104       "check_example.cc",
2105     ]
2106     deps = [
2107       ":base",
2108       "//build/win:default_exe_manifest",
2109     ]
2110   }
2111 }
2112
2113 if (is_win) {
2114   # Target to manually rebuild pe_image_test.dll which is checked into
2115   # base/test/data/pe_image.
2116   shared_library("pe_image_test") {
2117     sources = [
2118       "win/pe_image_test.cc",
2119     ]
2120     ldflags = [
2121       "/DELAYLOAD:cfgmgr32.dll",
2122       "/DELAYLOAD:shell32.dll",
2123       "/SUBSYSTEM:WINDOWS",
2124     ]
2125     libs = [
2126       "cfgmgr32.lib",
2127       "shell32.lib",
2128     ]
2129   }
2130
2131   loadable_module("scoped_handle_test_dll") {
2132     sources = [
2133       "win/scoped_handle_test_dll.cc",
2134     ]
2135     deps = [
2136       ":base",
2137       "//base/win:base_win_buildflags",
2138     ]
2139   }
2140 }
2141
2142 if (is_win || is_mac) {
2143   if (current_cpu == "x64") {
2144     # Must be a shared library so that it can be unloaded during testing.
2145     shared_library("base_profiler_test_support_library") {
2146       sources = [
2147         "profiler/test_support_library.cc",
2148       ]
2149     }
2150   }
2151 }
2152
2153 bundle_data("base_unittests_bundle_data") {
2154   testonly = true
2155   sources = [
2156     "//tools/metrics/histograms/enums.xml",
2157     "test/data/file_util/binary_file.bin",
2158     "test/data/file_util/binary_file_diff.bin",
2159     "test/data/file_util/binary_file_same.bin",
2160     "test/data/file_util/blank_line.txt",
2161     "test/data/file_util/blank_line_crlf.txt",
2162     "test/data/file_util/crlf.txt",
2163     "test/data/file_util/different.txt",
2164     "test/data/file_util/different_first.txt",
2165     "test/data/file_util/different_last.txt",
2166     "test/data/file_util/empty1.txt",
2167     "test/data/file_util/empty2.txt",
2168     "test/data/file_util/first1.txt",
2169     "test/data/file_util/first2.txt",
2170     "test/data/file_util/original.txt",
2171     "test/data/file_util/same.txt",
2172     "test/data/file_util/same_length.txt",
2173     "test/data/file_util/shortened.txt",
2174     "test/data/json/bom_feff.json",
2175     "test/data/serializer_nested_test.json",
2176     "test/data/serializer_test.json",
2177     "test/data/serializer_test_nowhitespace.json",
2178   ]
2179   outputs = [
2180     "{{bundle_resources_dir}}/" +
2181         "{{source_root_relative_dir}}/{{source_file_part}}",
2182   ]
2183 }
2184
2185 if (is_ios || is_mac) {
2186   source_set("base_unittests_arc") {
2187     testonly = true
2188     set_sources_assignment_filter([])
2189     sources = [
2190       "mac/bind_objc_block_unittest_arc.mm",
2191       "mac/scoped_nsobject_unittest_arc.mm",
2192     ]
2193     set_sources_assignment_filter(sources_assignment_filter)
2194     configs += [ "//build/config/compiler:enable_arc" ]
2195     deps = [
2196       ":base",
2197       "//testing/gtest",
2198     ]
2199   }
2200 }
2201
2202 if (is_fuchsia) {
2203   fidl_library("test_fidl") {
2204     namespace = "base.fuchsia"
2205     namespace_path = "base/fuchsia"
2206
2207     sources = [
2208       "fuchsia/test.fidl",
2209     ]
2210   }
2211 }
2212
2213 test("base_unittests") {
2214   sources = [
2215     "allocator/allocator_interception_mac_unittest.mm",
2216     "allocator/malloc_zone_functions_mac_unittest.cc",
2217     "allocator/tcmalloc_unittest.cc",
2218     "android/android_image_reader_compat_unittest.cc",
2219     "android/application_status_listener_unittest.cc",
2220     "android/content_uri_utils_unittest.cc",
2221     "android/jni_android_unittest.cc",
2222     "android/jni_array_unittest.cc",
2223     "android/jni_string_unittest.cc",
2224     "android/library_loader/library_prefetcher_unittest.cc",
2225     "android/path_utils_unittest.cc",
2226     "android/scoped_java_ref_unittest.cc",
2227     "android/sys_utils_unittest.cc",
2228     "android/unguessable_token_android_unittest.cc",
2229     "at_exit_unittest.cc",
2230     "atomicops_unittest.cc",
2231     "barrier_closure_unittest.cc",
2232     "base64_unittest.cc",
2233     "base64url_unittest.cc",
2234     "big_endian_unittest.cc",
2235     "bind_unittest.cc",
2236     "bit_cast_unittest.cc",
2237     "bits_unittest.cc",
2238     "build_time_unittest.cc",
2239     "callback_helpers_unittest.cc",
2240     "callback_list_unittest.cc",
2241     "callback_unittest.cc",
2242     "cancelable_callback_unittest.cc",
2243     "command_line_unittest.cc",
2244     "component_export_unittest.cc",
2245     "containers/adapters_unittest.cc",
2246     "containers/circular_deque_unittest.cc",
2247     "containers/flat_map_unittest.cc",
2248     "containers/flat_set_unittest.cc",
2249     "containers/flat_tree_unittest.cc",
2250     "containers/hash_tables_unittest.cc",
2251     "containers/id_map_unittest.cc",
2252     "containers/linked_list_unittest.cc",
2253     "containers/mru_cache_unittest.cc",
2254     "containers/small_map_unittest.cc",
2255     "containers/span_unittest.cc",
2256     "containers/stack_container_unittest.cc",
2257     "containers/unique_ptr_adapters_unittest.cc",
2258     "containers/vector_buffer_unittest.cc",
2259     "cpu_unittest.cc",
2260     "debug/activity_analyzer_unittest.cc",
2261     "debug/activity_tracker_unittest.cc",
2262     "debug/alias_unittest.cc",
2263     "debug/crash_logging_unittest.cc",
2264     "debug/debugger_unittest.cc",
2265     "debug/elf_reader_linux_unittest.cc",
2266     "debug/leak_tracker_unittest.cc",
2267     "debug/proc_maps_linux_unittest.cc",
2268     "debug/stack_trace_unittest.cc",
2269     "debug/task_annotator_unittest.cc",
2270     "debug/thread_heap_usage_tracker_unittest.cc",
2271     "deferred_sequenced_task_runner_unittest.cc",
2272     "environment_unittest.cc",
2273     "feature_list_unittest.cc",
2274     "file_version_info_win_unittest.cc",
2275     "files/file_enumerator_unittest.cc",
2276     "files/file_path_unittest.cc",
2277     "files/file_path_watcher_unittest.cc",
2278     "files/file_proxy_unittest.cc",
2279     "files/file_unittest.cc",
2280     "files/file_util_unittest.cc",
2281     "files/important_file_writer_unittest.cc",
2282     "files/memory_mapped_file_unittest.cc",
2283     "files/scoped_temp_dir_unittest.cc",
2284     "gmock_unittest.cc",
2285     "guid_unittest.cc",
2286     "hash_unittest.cc",
2287     "i18n/bidi_line_iterator_unittest.cc",
2288     "i18n/break_iterator_unittest.cc",
2289     "i18n/case_conversion_unittest.cc",
2290     "i18n/char_iterator_unittest.cc",
2291     "i18n/character_encoding_unittest.cc",
2292     "i18n/file_util_icu_unittest.cc",
2293     "i18n/icu_string_conversions_unittest.cc",
2294     "i18n/message_formatter_unittest.cc",
2295     "i18n/number_formatting_unittest.cc",
2296     "i18n/rtl_unittest.cc",
2297     "i18n/streaming_utf8_validator_unittest.cc",
2298     "i18n/string_search_unittest.cc",
2299     "i18n/time_formatting_unittest.cc",
2300     "i18n/timezone_unittest.cc",
2301     "ios/crb_protocol_observers_unittest.mm",
2302     "ios/device_util_unittest.mm",
2303     "ios/weak_nsobject_unittest.mm",
2304     "json/json_parser_unittest.cc",
2305     "json/json_reader_unittest.cc",
2306     "json/json_value_converter_unittest.cc",
2307     "json/json_value_serializer_unittest.cc",
2308     "json/json_writer_unittest.cc",
2309     "json/string_escape_unittest.cc",
2310     "lazy_instance_unittest.cc",
2311     "logging_unittest.cc",
2312     "mac/bind_objc_block_unittest.mm",
2313     "mac/call_with_eh_frame_unittest.mm",
2314     "mac/dispatch_source_mach_unittest.cc",
2315     "mac/foundation_util_unittest.mm",
2316     "mac/mac_util_unittest.mm",
2317     "mac/mach_port_broker_unittest.cc",
2318     "mac/objc_release_properties_unittest.mm",
2319     "mac/scoped_nsobject_unittest.mm",
2320     "mac/scoped_objc_class_swizzler_unittest.mm",
2321     "mac/scoped_sending_event_unittest.mm",
2322     "md5_unittest.cc",
2323     "memory/aligned_memory_unittest.cc",
2324     "memory/discardable_shared_memory_unittest.cc",
2325     "memory/linked_ptr_unittest.cc",
2326     "memory/memory_coordinator_client_registry_unittest.cc",
2327     "memory/memory_pressure_listener_unittest.cc",
2328     "memory/memory_pressure_monitor_chromeos_unittest.cc",
2329     "memory/memory_pressure_monitor_mac_unittest.cc",
2330     "memory/memory_pressure_monitor_unittest.cc",
2331     "memory/memory_pressure_monitor_win_unittest.cc",
2332     "memory/platform_shared_memory_region_unittest.cc",
2333     "memory/protected_memory_unittest.cc",
2334     "memory/ptr_util_unittest.cc",
2335     "memory/ref_counted_memory_unittest.cc",
2336     "memory/ref_counted_unittest.cc",
2337     "memory/shared_memory_mac_unittest.cc",
2338     "memory/shared_memory_region_unittest.cc",
2339     "memory/shared_memory_unittest.cc",
2340     "memory/shared_memory_win_unittest.cc",
2341     "memory/singleton_unittest.cc",
2342     "memory/weak_ptr_unittest.cc",
2343     "message_loop/message_loop_task_runner_unittest.cc",
2344     "message_loop/message_loop_unittest.cc",
2345     "message_loop/message_pump_glib_unittest.cc",
2346     "message_loop/message_pump_io_ios_unittest.cc",
2347     "message_loop/message_pump_mac_unittest.mm",
2348     "metrics/bucket_ranges_unittest.cc",
2349     "metrics/field_trial_params_unittest.cc",
2350     "metrics/field_trial_unittest.cc",
2351     "metrics/histogram_base_unittest.cc",
2352     "metrics/histogram_delta_serialization_unittest.cc",
2353     "metrics/histogram_functions_unittest.cc",
2354     "metrics/histogram_macros_unittest.cc",
2355     "metrics/histogram_samples_unittest.cc",
2356     "metrics/histogram_snapshot_manager_unittest.cc",
2357     "metrics/histogram_unittest.cc",
2358     "metrics/metrics_hashes_unittest.cc",
2359     "metrics/persistent_histogram_allocator_unittest.cc",
2360     "metrics/persistent_histogram_storage_unittest.cc",
2361     "metrics/persistent_memory_allocator_unittest.cc",
2362     "metrics/persistent_sample_map_unittest.cc",
2363     "metrics/sample_map_unittest.cc",
2364     "metrics/sample_vector_unittest.cc",
2365     "metrics/single_sample_metrics_unittest.cc",
2366     "metrics/sparse_histogram_unittest.cc",
2367     "metrics/statistics_recorder_unittest.cc",
2368     "native_library_unittest.cc",
2369     "no_destructor_unittest.cc",
2370     "observer_list_unittest.cc",
2371     "optional_unittest.cc",
2372     "os_compat_android_unittest.cc",
2373     "path_service_unittest.cc",
2374     "pickle_unittest.cc",
2375     "power_monitor/power_monitor_unittest.cc",
2376     "process/launch_unittest_win.cc",
2377     "process/memory_unittest.cc",
2378     "process/memory_unittest_mac.h",
2379     "process/memory_unittest_mac.mm",
2380     "process/process_info_unittest.cc",
2381     "process/process_metrics_unittest.cc",
2382     "process/process_unittest.cc",
2383     "process/process_util_unittest.cc",
2384     "profiler/stack_sampling_profiler_unittest.cc",
2385     "rand_util_unittest.cc",
2386     "run_loop_unittest.cc",
2387     "safe_numerics_unittest.cc",
2388     "sampling_heap_profiler/lock_free_address_hash_set_unittest.cc",
2389     "scoped_clear_errno_unittest.cc",
2390     "scoped_generic_unittest.cc",
2391     "scoped_native_library_unittest.cc",
2392     "security_unittest.cc",
2393     "sequence_checker_unittest.cc",
2394     "sequence_token_unittest.cc",
2395     "sequenced_task_runner_unittest.cc",
2396     "sha1_unittest.cc",
2397     "stl_util_unittest.cc",
2398     "strings/char_traits_unittest.cc",
2399     "strings/nullable_string16_unittest.cc",
2400     "strings/pattern_unittest.cc",
2401     "strings/safe_sprintf_unittest.cc",
2402     "strings/strcat_unittest.cc",
2403     "strings/string16_unittest.cc",
2404     "strings/string_number_conversions_unittest.cc",
2405     "strings/string_piece_unittest.cc",
2406     "strings/string_split_unittest.cc",
2407     "strings/string_tokenizer_unittest.cc",
2408     "strings/string_util_unittest.cc",
2409     "strings/stringize_macros_unittest.cc",
2410     "strings/stringprintf_unittest.cc",
2411     "strings/sys_string_conversions_mac_unittest.mm",
2412     "strings/sys_string_conversions_unittest.cc",
2413     "strings/utf_offset_string_conversions_unittest.cc",
2414     "strings/utf_string_conversions_unittest.cc",
2415     "supports_user_data_unittest.cc",
2416     "sync_socket_unittest.cc",
2417     "synchronization/atomic_flag_unittest.cc",
2418     "synchronization/condition_variable_unittest.cc",
2419     "synchronization/lock_unittest.cc",
2420     "synchronization/waitable_event_unittest.cc",
2421     "synchronization/waitable_event_watcher_unittest.cc",
2422     "sys_byteorder_unittest.cc",
2423     "sys_info_unittest.cc",
2424     "system_monitor/system_monitor_unittest.cc",
2425     "task/cancelable_task_tracker_unittest.cc",
2426     "task/sequence_manager/intrusive_heap_unittest.cc",
2427     "task/sequence_manager/lazily_deallocated_deque_unittest.cc",
2428     "task/sequence_manager/sequence_manager_impl_unittest.cc",
2429     "task/sequence_manager/task_queue_selector_unittest.cc",
2430     "task/sequence_manager/time_domain_unittest.cc",
2431     "task/sequence_manager/work_queue_sets_unittest.cc",
2432     "task/sequence_manager/work_queue_unittest.cc",
2433     "task_runner_util_unittest.cc",
2434     "task_scheduler/delayed_task_manager_unittest.cc",
2435     "task_scheduler/lazy_task_runner_unittest.cc",
2436     "task_scheduler/priority_queue_unittest.cc",
2437     "task_scheduler/scheduler_lock_unittest.cc",
2438     "task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc",
2439     "task_scheduler/scheduler_worker_pool_impl_unittest.cc",
2440     "task_scheduler/scheduler_worker_pool_unittest.cc",
2441     "task_scheduler/scheduler_worker_stack_unittest.cc",
2442     "task_scheduler/scheduler_worker_unittest.cc",
2443     "task_scheduler/scoped_set_task_priority_for_current_thread_unittest.cc",
2444     "task_scheduler/sequence_sort_key_unittest.cc",
2445     "task_scheduler/sequence_unittest.cc",
2446     "task_scheduler/service_thread_unittest.cc",
2447     "task_scheduler/task_scheduler_impl_unittest.cc",
2448     "task_scheduler/task_tracker_unittest.cc",
2449     "task_scheduler/task_traits_unittest.cc",
2450     "task_scheduler/task_unittest.cc",
2451     "task_scheduler/test_task_factory.cc",
2452     "task_scheduler/test_task_factory.h",
2453     "task_scheduler/test_utils.cc",
2454     "task_scheduler/test_utils.h",
2455     "task_scheduler/tracked_ref_unittest.cc",
2456     "template_util_unittest.cc",
2457     "test/metrics/histogram_enum_reader_unittest.cc",
2458     "test/metrics/histogram_tester_unittest.cc",
2459     "test/metrics/user_action_tester_unittest.cc",
2460     "test/mock_callback_unittest.cc",
2461     "test/scoped_feature_list_unittest.cc",
2462     "test/scoped_mock_time_message_loop_task_runner_unittest.cc",
2463     "test/scoped_task_environment_unittest.cc",
2464     "test/test_mock_time_task_runner_unittest.cc",
2465     "test/test_pending_task_unittest.cc",
2466     "test/test_reg_util_win_unittest.cc",
2467     "test/trace_event_analyzer_unittest.cc",
2468     "thread_annotations_unittest.cc",
2469     "threading/platform_thread_unittest.cc",
2470     "threading/post_task_and_reply_impl_unittest.cc",
2471     "threading/scoped_blocking_call_unittest.cc",
2472     "threading/sequence_local_storage_map_unittest.cc",
2473     "threading/sequence_local_storage_slot_unittest.cc",
2474     "threading/sequenced_task_runner_handle_unittest.cc",
2475     "threading/simple_thread_unittest.cc",
2476     "threading/thread_checker_unittest.cc",
2477     "threading/thread_collision_warner_unittest.cc",
2478     "threading/thread_id_name_manager_unittest.cc",
2479     "threading/thread_local_storage_unittest.cc",
2480     "threading/thread_local_unittest.cc",
2481     "threading/thread_restrictions_unittest.cc",
2482     "threading/thread_task_runner_handle_unittest.cc",
2483     "threading/thread_unittest.cc",
2484     "threading/watchdog_unittest.cc",
2485     "time/pr_time_unittest.cc",
2486     "time/time_unittest.cc",
2487     "time/time_win_unittest.cc",
2488     "timer/hi_res_timer_manager_unittest.cc",
2489     "timer/mock_timer_unittest.cc",
2490     "timer/timer_unittest.cc",
2491     "tools_sanity_unittest.cc",
2492     "trace_event/blame_context_unittest.cc",
2493     "trace_event/event_name_filter_unittest.cc",
2494     "trace_event/heap_profiler_allocation_context_tracker_unittest.cc",
2495     "trace_event/java_heap_dump_provider_android_unittest.cc",
2496     "trace_event/memory_allocator_dump_unittest.cc",
2497     "trace_event/memory_dump_manager_unittest.cc",
2498     "trace_event/memory_dump_scheduler_unittest.cc",
2499     "trace_event/memory_infra_background_whitelist_unittest.cc",
2500     "trace_event/memory_usage_estimator_unittest.cc",
2501     "trace_event/process_memory_dump_unittest.cc",
2502     "trace_event/trace_category_unittest.cc",
2503     "trace_event/trace_config_unittest.cc",
2504     "trace_event/trace_event_argument_unittest.cc",
2505     "trace_event/trace_event_filter_test_utils.cc",
2506     "trace_event/trace_event_filter_test_utils.h",
2507     "trace_event/trace_event_system_stats_monitor_unittest.cc",
2508     "trace_event/trace_event_unittest.cc",
2509     "tuple_unittest.cc",
2510     "unguessable_token_unittest.cc",
2511     "value_iterators_unittest.cc",
2512     "values_unittest.cc",
2513     "version_unittest.cc",
2514     "vlog_unittest.cc",
2515     "win/async_operation_unittest.cc",
2516     "win/com_init_check_hook_unittest.cc",
2517     "win/com_init_util_unittest.cc",
2518     "win/core_winrt_util_unittest.cc",
2519     "win/dllmain.cc",
2520     "win/enum_variant_unittest.cc",
2521     "win/event_trace_consumer_unittest.cc",
2522     "win/event_trace_controller_unittest.cc",
2523     "win/event_trace_provider_unittest.cc",
2524     "win/i18n_unittest.cc",
2525     "win/iunknown_impl_unittest.cc",
2526     "win/message_window_unittest.cc",
2527     "win/object_watcher_unittest.cc",
2528     "win/pe_image_unittest.cc",
2529     "win/reference_unittest.cc",
2530     "win/registry_unittest.cc",
2531     "win/scoped_bstr_unittest.cc",
2532     "win/scoped_handle_unittest.cc",
2533     "win/scoped_hstring_unittest.cc",
2534     "win/scoped_process_information_unittest.cc",
2535     "win/scoped_variant_unittest.cc",
2536     "win/scoped_winrt_initializer_unittest.cc",
2537     "win/shortcut_unittest.cc",
2538     "win/startup_information_unittest.cc",
2539     "win/typed_event_handler_unittest.cc",
2540     "win/vector_unittest.cc",
2541     "win/wait_chain_unittest.cc",
2542     "win/win_includes_unittest.cc",
2543     "win/win_util_unittest.cc",
2544     "win/windows_version_unittest.cc",
2545     "win/winrt_storage_util_unittest.cc",
2546     "win/wrapped_window_proc_unittest.cc",
2547   ]
2548
2549   defines = []
2550
2551   if (use_efl) {
2552     configs += external_base_configs
2553   }
2554
2555   deps = [
2556     ":base",
2557     ":i18n",
2558     "//base/allocator:buildflags",
2559     "//base/test:native_library_test_utils",
2560     "//base/test:run_all_base_unittests",
2561     "//base/test:test_support",
2562     "//base/third_party/dynamic_annotations",
2563     "//testing/gmock",
2564     "//testing/gtest",
2565     "//third_party/icu",
2566   ]
2567
2568   data_deps = [
2569     "//base/test:test_child_process",
2570     "//base/test:test_shared_library",
2571   ]
2572
2573   if (is_ios || is_mac) {
2574     deps += [ ":base_unittests_arc" ]
2575   }
2576
2577   public_deps = [
2578     ":base_unittests_bundle_data",
2579   ]
2580
2581   data = [
2582     "test/data/",
2583     "//tools/metrics/histograms/enums.xml",
2584   ]
2585
2586   if (is_posix) {
2587     sources += [
2588       "files/dir_reader_posix_unittest.cc",
2589       "files/file_descriptor_watcher_posix_unittest.cc",
2590       "message_loop/message_loop_io_posix_unittest.cc",
2591       "posix/file_descriptor_shuffle_unittest.cc",
2592       "posix/unix_domain_socket_unittest.cc",
2593       "task_scheduler/task_tracker_posix_unittest.cc",
2594     ]
2595   }
2596
2597   # Allow more direct string conversions on platforms with native utf8
2598   # strings
2599   if (is_mac || is_ios || is_chromeos || is_chromecast || is_fuchsia) {
2600     defines += [ "SYSTEM_NATIVE_UTF8" ]
2601   }
2602
2603   if (is_android) {
2604     # Add unwind tables in base_unittests_apk test apk. The unwind tables are
2605     # generated from debug info in the binary. Removing "default_symbols" and
2606     # adding symbols config removes the "strip_debug" config that strips the
2607     # debug info, on base unittests apk.
2608     if (can_unwind_with_cfi_table) {
2609       configs -= [ "//build/config/compiler:default_symbols" ]
2610       if (symbol_level == 2) {
2611         configs += [ "//build/config/compiler:symbols" ]
2612       } else {
2613         configs += [ "//build/config/compiler:minimal_symbols" ]
2614       }
2615       add_unwind_tables_in_apk = true
2616       sources += [ "trace_event/cfi_backtrace_android_unittest.cc" ]
2617     }
2618     sources -= [
2619       "process/process_unittest.cc",
2620       "process/process_util_unittest.cc",
2621     ]
2622     deps += [
2623       ":base_java",
2624       ":base_java_unittest_support",
2625       "//base/test:test_support_java",
2626     ]
2627   }
2628
2629   if (is_ios) {
2630     sources -= [
2631       "files/file_path_watcher_unittest.cc",
2632       "memory/discardable_shared_memory_unittest.cc",
2633       "memory/shared_memory_unittest.cc",
2634       "process/memory_unittest.cc",
2635       "process/process_unittest.cc",
2636       "process/process_util_unittest.cc",
2637       "sync_socket_unittest.cc",
2638       "synchronization/waitable_event_watcher_unittest.cc",
2639     ]
2640
2641     # Pull in specific Mac files for iOS (which have been filtered out by file
2642     # name rules).
2643     set_sources_assignment_filter([])
2644     sources += [
2645       "mac/bind_objc_block_unittest.mm",
2646       "mac/foundation_util_unittest.mm",
2647       "mac/objc_release_properties_unittest.mm",
2648       "mac/scoped_nsobject_unittest.mm",
2649       "strings/sys_string_conversions_mac_unittest.mm",
2650     ]
2651     set_sources_assignment_filter(sources_assignment_filter)
2652
2653     # TODO(GYP): dep on copy_test_data_ios action.
2654   }
2655
2656   if (use_partition_alloc) {
2657     sources += [
2658       "allocator/partition_allocator/address_space_randomization_unittest.cc",
2659       "allocator/partition_allocator/page_allocator_unittest.cc",
2660       "allocator/partition_allocator/partition_alloc_unittest.cc",
2661       "allocator/partition_allocator/spin_lock_unittest.cc",
2662     ]
2663   }
2664
2665   if (is_mac) {
2666     libs = [
2667       "CoreFoundation.framework",
2668       "Foundation.framework",
2669     ]
2670     if (current_cpu == "x64") {
2671       data_deps += [ ":base_profiler_test_support_library" ]
2672     }
2673   }
2674
2675   if (is_linux) {
2676     if (is_desktop_linux) {
2677       sources += [ "nix/xdg_util_unittest.cc" ]
2678     }
2679
2680     deps += [ "//base/test:malloc_wrapper" ]
2681     defines += [
2682       # This library is used by ElfReaderTest to test reading elf files.
2683       "MALLOC_WRAPPER_LIB=\"${shlib_prefix}malloc_wrapper${shlib_extension}\"",
2684     ]
2685
2686     if (!is_component_build) {
2687       # Set rpath to find libmalloc_wrapper.so even in a non-component build.
2688       configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
2689     }
2690   }
2691
2692   if (!use_glib) {
2693     sources -= [ "message_loop/message_pump_glib_unittest.cc" ]
2694   }
2695
2696   if (use_libevent) {
2697     sources += [ "message_loop/message_pump_libevent_unittest.cc" ]
2698     deps += [ "//base/third_party/libevent" ]
2699   }
2700
2701   if (is_fuchsia) {
2702     sources += [
2703       "files/dir_reader_posix_unittest.cc",
2704       "files/file_descriptor_watcher_posix_unittest.cc",
2705       "fuchsia/async_dispatcher_unittest.cc",
2706       "fuchsia/filtered_service_directory_unittest.cc",
2707       "fuchsia/service_directory_test_base.cc",
2708       "fuchsia/service_directory_test_base.h",
2709       "fuchsia/service_directory_unittest.cc",
2710       "message_loop/message_loop_io_posix_unittest.cc",
2711       "posix/file_descriptor_shuffle_unittest.cc",
2712       "task_scheduler/task_tracker_posix_unittest.cc",
2713     ]
2714
2715     # TODO(crbug.com/851641): FilePatchWatcherImpl is not implemented.
2716     sources -= [ "files/file_path_watcher_unittest.cc" ]
2717
2718     deps += [
2719       ":test_fidl",
2720       "//third_party/fuchsia-sdk:async",
2721       "//third_party/fuchsia-sdk:async_default",
2722       "//third_party/fuchsia-sdk:fdio",
2723     ]
2724   }
2725
2726   if (!is_fuchsia && !is_ios) {
2727     sources += [ "files/file_locking_unittest.cc" ]
2728   }
2729
2730   if (is_android) {
2731     deps += [ "//testing/android/native_test:native_test_native_code" ]
2732     set_sources_assignment_filter([])
2733     sources += [
2734       "debug/elf_reader_linux_unittest.cc",
2735       "debug/proc_maps_linux_unittest.cc",
2736       "trace_event/trace_event_android_unittest.cc",
2737     ]
2738     set_sources_assignment_filter(sources_assignment_filter)
2739   }
2740
2741   if (is_win) {
2742     deps += [ "//base:scoped_handle_test_dll" ]
2743     if (current_cpu == "x64") {
2744       sources += [ "profiler/win32_stack_frame_unwinder_unittest.cc" ]
2745       data_deps += [ ":base_profiler_test_support_library" ]
2746     }
2747   }
2748
2749   if (use_allocator_shim) {
2750     sources += [
2751       "allocator/allocator_shim_unittest.cc",
2752       "sampling_heap_profiler/sampling_heap_profiler_unittest.cc",
2753     ]
2754   }
2755
2756   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
2757   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
2758
2759   # Symbols for crashes when running tests on swarming.
2760   if (symbol_level > 0) {
2761     if (is_win) {
2762       data += [ "$root_out_dir/base_unittests.exe.pdb" ]
2763     } else if (is_mac) {
2764       # TODO(crbug.com/330301): make this conditional on mac_strip_release.
2765       # data += [ "$root_out_dir/base_unittests.dSYM/" ]
2766     }
2767   }
2768 }
2769
2770 action("build_date") {
2771   script = "//build/write_build_date_header.py"
2772
2773   # Force recalculation if there's been a change.
2774   inputs = [
2775     "//build/util/LASTCHANGE",
2776   ]
2777   outputs = [
2778     "$target_gen_dir/generated_build_date.h",
2779   ]
2780
2781   args =
2782       [ rebase_path("$target_gen_dir/generated_build_date.h", root_build_dir) ]
2783
2784   if (is_official_build) {
2785     args += [ "official" ]
2786   } else {
2787     args += [ "default" ]
2788   }
2789
2790   if (override_build_date != "N/A") {
2791     args += [ override_build_date ]
2792   }
2793 }
2794
2795 if (enable_nocompile_tests) {
2796   nocompile_test("base_nocompile_tests") {
2797     sources = [
2798       "bind_unittest.nc",
2799       "callback_list_unittest.nc",
2800       "callback_unittest.nc",
2801       "containers/span_unittest.nc",
2802       "memory/ref_counted_unittest.nc",
2803       "memory/weak_ptr_unittest.nc",
2804       "metrics/field_trial_params_unittest.nc",
2805       "metrics/histogram_unittest.nc",
2806       "optional_unittest.nc",
2807       "strings/string16_unittest.nc",
2808       "task_scheduler/task_traits_unittest.nc",
2809       "thread_annotations_unittest.nc",
2810     ]
2811
2812     deps = [
2813       ":base",
2814       "//base/test:run_all_unittests",
2815       "//testing/gtest",
2816     ]
2817   }
2818 }
2819
2820 if (is_android) {
2821   generate_jni("base_jni_headers") {
2822     sources = [
2823       "android/java/src/org/chromium/base/AnimationFrameTimeHistogram.java",
2824       "android/java/src/org/chromium/base/ApkAssets.java",
2825       "android/java/src/org/chromium/base/ApplicationStatus.java",
2826       "android/java/src/org/chromium/base/BuildInfo.java",
2827       "android/java/src/org/chromium/base/Callback.java",
2828       "android/java/src/org/chromium/base/CommandLine.java",
2829       "android/java/src/org/chromium/base/ContentUriUtils.java",
2830       "android/java/src/org/chromium/base/CpuFeatures.java",
2831       "android/java/src/org/chromium/base/EarlyTraceEvent.java",
2832       "android/java/src/org/chromium/base/EventLog.java",
2833       "android/java/src/org/chromium/base/FieldTrialList.java",
2834       "android/java/src/org/chromium/base/ImportantFileWriterAndroid.java",
2835       "android/java/src/org/chromium/base/JNIUtils.java",
2836       "android/java/src/org/chromium/base/JavaExceptionReporter.java",
2837       "android/java/src/org/chromium/base/JavaHandlerThread.java",
2838       "android/java/src/org/chromium/base/LocaleUtils.java",
2839       "android/java/src/org/chromium/base/MemoryPressureListener.java",
2840       "android/java/src/org/chromium/base/PathService.java",
2841       "android/java/src/org/chromium/base/PathUtils.java",
2842       "android/java/src/org/chromium/base/PowerMonitor.java",
2843       "android/java/src/org/chromium/base/SysUtils.java",
2844       "android/java/src/org/chromium/base/ThreadUtils.java",
2845       "android/java/src/org/chromium/base/ThrowUncaughtException.java",
2846       "android/java/src/org/chromium/base/TimeUtils.java",
2847       "android/java/src/org/chromium/base/TimezoneUtils.java",
2848       "android/java/src/org/chromium/base/TraceEvent.java",
2849       "android/java/src/org/chromium/base/UnguessableToken.java",
2850       "android/java/src/org/chromium/base/library_loader/LibraryLoader.java",
2851       "android/java/src/org/chromium/base/metrics/RecordHistogram.java",
2852       "android/java/src/org/chromium/base/metrics/RecordUserAction.java",
2853       "android/java/src/org/chromium/base/metrics/StatisticsRecorderAndroid.java",
2854       "android/java/src/org/chromium/base/process_launcher/ChildProcessService.java",
2855     ]
2856
2857     public_deps = [
2858       ":android_runtime_jni_headers",
2859     ]
2860
2861     jni_package = "base"
2862   }
2863
2864   generate_jar_jni("android_runtime_jni_headers") {
2865     jni_package = "base"
2866     classes = [ "java/lang/Runtime.class" ]
2867   }
2868
2869   android_library("base_java") {
2870     srcjar_deps = [
2871       ":base_android_java_enums_srcjar",
2872       ":base_build_config_gen",
2873       ":base_java_aidl",
2874       ":base_native_libraries_gen",
2875     ]
2876
2877     deps = [
2878       "//third_party/android_tools:android_support_annotations_java",
2879       "//third_party/android_tools:android_support_multidex_java",
2880       "//third_party/android_tools:android_support_v4_java",
2881       "//third_party/jsr-305:jsr_305_javalib",
2882     ]
2883
2884     java_files = [
2885       "android/java/src/org/chromium/base/ActivityState.java",
2886       "android/java/src/org/chromium/base/AnimationFrameTimeHistogram.java",
2887       "android/java/src/org/chromium/base/ApiCompatibilityUtils.java",
2888       "android/java/src/org/chromium/base/ApkAssets.java",
2889       "android/java/src/org/chromium/base/ApplicationStatus.java",
2890       "android/java/src/org/chromium/base/BaseSwitches.java",
2891       "android/java/src/org/chromium/base/BuildInfo.java",
2892       "android/java/src/org/chromium/base/Callback.java",
2893       "android/java/src/org/chromium/base/CollectionUtil.java",
2894       "android/java/src/org/chromium/base/CommandLine.java",
2895       "android/java/src/org/chromium/base/CommandLineInitUtil.java",
2896       "android/java/src/org/chromium/base/ContentUriUtils.java",
2897       "android/java/src/org/chromium/base/ContextUtils.java",
2898       "android/java/src/org/chromium/base/CpuFeatures.java",
2899       "android/java/src/org/chromium/base/DiscardableReferencePool.java",
2900       "android/java/src/org/chromium/base/EarlyTraceEvent.java",
2901       "android/java/src/org/chromium/base/EventLog.java",
2902       "android/java/src/org/chromium/base/FieldTrialList.java",
2903       "android/java/src/org/chromium/base/FileUtils.java",
2904       "android/java/src/org/chromium/base/ImportantFileWriterAndroid.java",
2905       "android/java/src/org/chromium/base/JNIUtils.java",
2906       "android/java/src/org/chromium/base/JavaExceptionReporter.java",
2907       "android/java/src/org/chromium/base/JavaHandlerThread.java",
2908       "android/java/src/org/chromium/base/LocaleUtils.java",
2909       "android/java/src/org/chromium/base/Log.java",
2910       "android/java/src/org/chromium/base/MemoryPressureListener.java",
2911       "android/java/src/org/chromium/base/NonThreadSafe.java",
2912       "android/java/src/org/chromium/base/ObserverList.java",
2913       "android/java/src/org/chromium/base/PackageUtils.java",
2914       "android/java/src/org/chromium/base/PathService.java",
2915       "android/java/src/org/chromium/base/PathUtils.java",
2916       "android/java/src/org/chromium/base/PowerMonitor.java",
2917       "android/java/src/org/chromium/base/Promise.java",
2918       "android/java/src/org/chromium/base/SecureRandomInitializer.java",
2919       "android/java/src/org/chromium/base/StreamUtil.java",
2920       "android/java/src/org/chromium/base/StrictModeContext.java",
2921       "android/java/src/org/chromium/base/Supplier.java",
2922       "android/java/src/org/chromium/base/SysUtils.java",
2923       "android/java/src/org/chromium/base/ThreadUtils.java",
2924       "android/java/src/org/chromium/base/ThrowUncaughtException.java",
2925       "android/java/src/org/chromium/base/TimeUtils.java",
2926       "android/java/src/org/chromium/base/TimezoneUtils.java",
2927       "android/java/src/org/chromium/base/TraceEvent.java",
2928       "android/java/src/org/chromium/base/UnguessableToken.java",
2929       "android/java/src/org/chromium/base/VisibleForTesting.java",
2930       "android/java/src/org/chromium/base/annotations/AccessedByNative.java",
2931       "android/java/src/org/chromium/base/annotations/CalledByNative.java",
2932       "android/java/src/org/chromium/base/annotations/CalledByNativeUnchecked.java",
2933       "android/java/src/org/chromium/base/annotations/DoNotInline.java",
2934       "android/java/src/org/chromium/base/annotations/JNIAdditionalImport.java",
2935       "android/java/src/org/chromium/base/annotations/JNINamespace.java",
2936       "android/java/src/org/chromium/base/annotations/MainDex.java",
2937       "android/java/src/org/chromium/base/annotations/NativeCall.java",
2938       "android/java/src/org/chromium/base/annotations/NativeClassQualifiedName.java",
2939       "android/java/src/org/chromium/base/annotations/RemovableInRelease.java",
2940       "android/java/src/org/chromium/base/annotations/UsedByReflection.java",
2941       "android/java/src/org/chromium/base/library_loader/LibraryLoader.java",
2942       "android/java/src/org/chromium/base/library_loader/Linker.java",
2943       "android/java/src/org/chromium/base/library_loader/LoaderErrors.java",
2944       "android/java/src/org/chromium/base/library_loader/NativeLibraryPreloader.java",
2945       "android/java/src/org/chromium/base/library_loader/ProcessInitException.java",
2946       "android/java/src/org/chromium/base/metrics/CachedMetrics.java",
2947       "android/java/src/org/chromium/base/metrics/RecordHistogram.java",
2948       "android/java/src/org/chromium/base/metrics/RecordUserAction.java",
2949       "android/java/src/org/chromium/base/metrics/StatisticsRecorderAndroid.java",
2950       "android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java",
2951       "android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java",
2952       "android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java",
2953       "android/java/src/org/chromium/base/process_launcher/ChildProcessConstants.java",
2954       "android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java",
2955       "android/java/src/org/chromium/base/process_launcher/ChildProcessService.java",
2956       "android/java/src/org/chromium/base/process_launcher/ChildProcessServiceDelegate.java",
2957       "android/java/src/org/chromium/base/process_launcher/FileDescriptorInfo.java",
2958       "android/java/src/org/chromium/base/memory/MemoryPressureMonitor.java",
2959       "android/java/src/org/chromium/base/memory/MemoryPressureCallback.java",
2960       "android/java/src/org/chromium/base/memory/MemoryPressureUma.java",
2961       "//third_party/android_async_task/java/src/org/chromium/base/AsyncTask.java",
2962     ]
2963
2964     # New versions of BuildConfig.java and NativeLibraries.java
2965     # (with the actual correct values) will be created when creating an apk.
2966     jar_excluded_patterns = [
2967       "*/BuildConfig.class",
2968       "*/NativeLibraries.class",
2969       "*/NativeLibraries##*.class",
2970     ]
2971   }
2972
2973   android_aidl("base_java_aidl") {
2974     import_include = [ "android/java/src" ]
2975     sources = [
2976       "android/java/src/org/chromium/base/process_launcher/ICallbackInt.aidl",
2977       "android/java/src/org/chromium/base/process_launcher/IChildProcessService.aidl",
2978     ]
2979   }
2980
2981   android_library("base_javatests") {
2982     testonly = true
2983     deps = [
2984       ":base_java",
2985       ":base_java_test_support",
2986       "//third_party/android_support_test_runner:runner_java",
2987       "//third_party/junit:junit",
2988     ]
2989     java_files = [
2990       # AssertsTest doesn't really belong in //base but it's preferable to
2991       # stick it here than create another target for a single test.
2992       "android/javatests/src/org/chromium/base/AssertsTest.java",
2993       "android/javatests/src/org/chromium/base/AsyncTaskTest.java",
2994       "android/javatests/src/org/chromium/base/AdvancedMockContextTest.java",
2995       "android/javatests/src/org/chromium/base/ApiCompatibilityUtilsTest.java",
2996       "android/javatests/src/org/chromium/base/CommandLineInitUtilTest.java",
2997       "android/javatests/src/org/chromium/base/CommandLineTest.java",
2998       "android/javatests/src/org/chromium/base/EarlyTraceEventTest.java",
2999
3000       # TODO(nona): move to Junit once that is built for Android N.
3001       "android/javatests/src/org/chromium/base/LocaleUtilsTest.java",
3002       "android/javatests/src/org/chromium/base/ObserverListTest.java",
3003       "android/javatests/src/org/chromium/base/StrictModeContextTest.java",
3004       "android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java",
3005     ]
3006   }
3007
3008   android_library("base_java_test_support") {
3009     testonly = true
3010     deps = [
3011       ":base_java",
3012       "//testing/android/reporter:reporter_java",
3013       "//third_party/android_support_test_runner:exposed_instrumentation_api_publish_java",
3014       "//third_party/android_support_test_runner:rules_java",
3015       "//third_party/android_support_test_runner:runner_java",
3016       "//third_party/android_tools:android_support_annotations_java",
3017       "//third_party/android_tools:android_support_chromium_java",
3018       "//third_party/android_tools:android_support_compat_java",
3019       "//third_party/android_tools:android_test_mock_java",
3020       "//third_party/hamcrest:hamcrest_core_java",
3021       "//third_party/junit",
3022       "//third_party/ub-uiautomator:ub_uiautomator_java",
3023     ]
3024
3025     java_files = [
3026       "test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java",
3027       "test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java",
3028       "test/android/javatests/src/org/chromium/base/test/BaseChromiumRunnerCommon.java",
3029       "test/android/javatests/src/org/chromium/base/test/BaseTestResult.java",
3030       "test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java",
3031       "test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java",
3032       "test/android/javatests/src/org/chromium/base/test/SetUpStatement.java",
3033       "test/android/javatests/src/org/chromium/base/test/TestListInstrumentationRunListener.java",
3034       "test/android/javatests/src/org/chromium/base/test/TestTraceEvent.java",
3035       "test/android/javatests/src/org/chromium/base/test/params/ParameterizedRunner.java",
3036       "test/android/javatests/src/org/chromium/base/test/params/BlockJUnit4RunnerDelegate.java",
3037       "test/android/javatests/src/org/chromium/base/test/params/BaseJUnit4RunnerDelegate.java",
3038       "test/android/javatests/src/org/chromium/base/test/params/MethodParamAnnotationRule.java",
3039       "test/android/javatests/src/org/chromium/base/test/params/MethodParamRule.java",
3040       "test/android/javatests/src/org/chromium/base/test/params/ParameterAnnotations.java",
3041       "test/android/javatests/src/org/chromium/base/test/params/ParameterizedFrameworkMethod.java",
3042       "test/android/javatests/src/org/chromium/base/test/params/ParameterizedRunnerDelegate.java",
3043       "test/android/javatests/src/org/chromium/base/test/params/ParameterizedRunnerDelegateCommon.java",
3044       "test/android/javatests/src/org/chromium/base/test/params/ParameterizedRunnerDelegateFactory.java",
3045       "test/android/javatests/src/org/chromium/base/test/params/ParameterProvider.java",
3046       "test/android/javatests/src/org/chromium/base/test/params/ParameterSet.java",
3047       "test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java",
3048       "test/android/javatests/src/org/chromium/base/test/util/AnnotationRule.java",
3049       "test/android/javatests/src/org/chromium/base/test/util/CallbackHelper.java",
3050       "test/android/javatests/src/org/chromium/base/test/util/CommandLineFlags.java",
3051       "test/android/javatests/src/org/chromium/base/test/util/DisableIf.java",
3052       "test/android/javatests/src/org/chromium/base/test/util/DisableIfSkipCheck.java",
3053       "test/android/javatests/src/org/chromium/base/test/util/AnnotationProcessingUtils.java",
3054       "test/android/javatests/src/org/chromium/base/test/util/DisabledTest.java",
3055       "test/android/javatests/src/org/chromium/base/test/util/EnormousTest.java",
3056       "test/android/javatests/src/org/chromium/base/test/util/Feature.java",
3057       "test/android/javatests/src/org/chromium/base/test/util/FlakyTest.java",
3058       "test/android/javatests/src/org/chromium/base/test/util/InMemorySharedPreferences.java",
3059       "test/android/javatests/src/org/chromium/base/test/util/InstrumentationUtils.java",
3060       "test/android/javatests/src/org/chromium/base/test/util/IntegrationTest.java",
3061       "test/android/javatests/src/org/chromium/base/test/util/Manual.java",
3062       "test/android/javatests/src/org/chromium/base/test/util/Matchers.java",
3063       "test/android/javatests/src/org/chromium/base/test/util/MetricsUtils.java",
3064       "test/android/javatests/src/org/chromium/base/test/util/MinAndroidSdkLevel.java",
3065       "test/android/javatests/src/org/chromium/base/test/util/MinAndroidSdkLevelSkipCheck.java",
3066       "test/android/javatests/src/org/chromium/base/test/util/Restriction.java",
3067       "test/android/javatests/src/org/chromium/base/test/util/RestrictionSkipCheck.java",
3068       "test/android/javatests/src/org/chromium/base/test/util/RetryOnFailure.java",
3069       "test/android/javatests/src/org/chromium/base/test/util/ScalableTimeout.java",
3070       "test/android/javatests/src/org/chromium/base/test/util/SkipCheck.java",
3071       "test/android/javatests/src/org/chromium/base/test/util/TestFileUtil.java",
3072       "test/android/javatests/src/org/chromium/base/test/util/TestThread.java",
3073       "test/android/javatests/src/org/chromium/base/test/util/TimeoutScale.java",
3074       "test/android/javatests/src/org/chromium/base/test/util/UserActionTester.java",
3075       "test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java",
3076       "test/android/javatests/src/org/chromium/base/test/util/parameter/CommandLineParameter.java",
3077       "test/android/javatests/src/org/chromium/base/test/util/parameter/SkipCommandLineParameterization.java",
3078     ]
3079   }
3080
3081   android_library("base_java_process_launcher_test_support") {
3082     testonly = true
3083     deps = [
3084       ":base_java",
3085       ":base_java_test_support",
3086     ]
3087     java_files = [ "test/android/javatests/src/org/chromium/base/test/TestChildProcessConnection.java" ]
3088   }
3089
3090   android_library("base_junit_test_support") {
3091     # Plaform checks are broken for Robolectric.
3092     bypass_platform_checks = true
3093     testonly = true
3094     java_files = [
3095       "android/junit/src/org/chromium/base/metrics/test/ShadowRecordHistogram.java",
3096       "test/android/junit/src/org/chromium/base/test/BaseRobolectricTestRunner.java",
3097       "test/android/junit/src/org/chromium/base/test/asynctask/BackgroundShadowAsyncTask.java",
3098       "test/android/junit/src/org/chromium/base/test/asynctask/CustomShadowAsyncTask.java",
3099       "test/android/junit/src/org/chromium/base/test/util/TestRunnerTestRule.java",
3100       "//third_party/robolectric/custom_asynctask/java/src/org/chromium/base/test/asynctask/ShadowAsyncTask.java",
3101       "//third_party/robolectric/custom_asynctask/java/src/org/chromium/base/test/asynctask/ShadowAsyncTaskBridge.java",
3102     ]
3103     deps = [
3104       ":base_java",
3105       "//testing/android/junit:junit_test_support",
3106       "//third_party/android_support_test_runner:runner_java",
3107       "//third_party/robolectric:robolectric_all_java",
3108     ]
3109   }
3110
3111   junit_binary("base_junit_tests") {
3112     java_files = [
3113       "android/junit/src/org/chromium/base/ApplicationStatusTest.java",
3114       "android/junit/src/org/chromium/base/DiscardableReferencePoolTest.java",
3115       "android/junit/src/org/chromium/base/LogTest.java",
3116       "android/junit/src/org/chromium/base/NonThreadSafeTest.java",
3117       "android/junit/src/org/chromium/base/PromiseTest.java",
3118       "android/junit/src/org/chromium/base/memory/MemoryPressureMonitorTest.java",
3119       "android/junit/src/org/chromium/base/process_launcher/ChildConnectionAllocatorTest.java",
3120       "android/junit/src/org/chromium/base/process_launcher/ChildProcessConnectionTest.java",
3121       "test/android/junit/src/org/chromium/base/test/SetUpStatementTest.java",
3122       "test/android/junit/src/org/chromium/base/test/TestListInstrumentationRunListenerTest.java",
3123       "test/android/junit/src/org/chromium/base/test/util/AnnotationProcessingUtilsTest.java",
3124       "test/android/junit/src/org/chromium/base/test/util/DisableIfTest.java",
3125       "test/android/junit/src/org/chromium/base/test/util/MinAndroidSdkLevelSkipCheckTest.java",
3126       "test/android/junit/src/org/chromium/base/test/util/RestrictionSkipCheckTest.java",
3127       "test/android/junit/src/org/chromium/base/test/util/SkipCheckTest.java",
3128       "test/android/junit/src/org/chromium/base/test/params/ExampleParameterizedTest.java",
3129       "test/android/junit/src/org/chromium/base/test/params/ParameterizedRunnerTest.java",
3130       "test/android/junit/src/org/chromium/base/test/params/ParameterizedRunnerDelegateCommonTest.java",
3131       "test/android/junit/src/org/chromium/base/test/params/ParameterizedRunnerDelegateFactoryTest.java",
3132       "test/android/junit/src/org/chromium/base/test/params/ParameterizedTestNameTest.java",
3133     ]
3134     deps = [
3135       ":base_java",
3136       ":base_java_process_launcher_test_support",
3137       ":base_java_test_support",
3138       ":base_junit_test_support",
3139       "//third_party/hamcrest:hamcrest_java",
3140     ]
3141   }
3142
3143   java_cpp_enum("base_android_java_enums_srcjar") {
3144     sources = [
3145       "android/application_status_listener.h",
3146       "android/child_process_binding_types.h",
3147       "android/library_loader/library_load_from_apk_status_codes.h",
3148       "android/library_loader/library_loader_hooks.h",
3149       "memory/memory_pressure_listener.h",
3150       "metrics/histogram_base.h",
3151       "trace_event/trace_config.h",
3152     ]
3153   }
3154
3155   generate_build_config_srcjar("base_build_config_gen") {
3156     use_final_fields = false
3157   }
3158
3159   java_cpp_template("base_native_libraries_gen") {
3160     sources = [
3161       "android/java/templates/NativeLibraries.template",
3162     ]
3163     package_path = "org/chromium/base/library_loader"
3164   }
3165
3166   android_library("base_java_unittest_support") {
3167     testonly = true
3168     deps = [
3169       ":base_java",
3170     ]
3171     java_files = [
3172       "test/android/java/src/org/chromium/base/ContentUriTestUtils.java",
3173       "test/android/java/src/org/chromium/base/JavaHandlerThreadHelpers.java",
3174     ]
3175   }
3176 }
3177
3178 # Keep the list of fuzzer_tests in alphabetical order.
3179 fuzzer_test("base64_decode_fuzzer") {
3180   sources = [
3181     "base64_decode_fuzzer.cc",
3182   ]
3183   deps = [
3184     "//base",
3185   ]
3186 }
3187
3188 fuzzer_test("base64_encode_fuzzer") {
3189   sources = [
3190     "base64_encode_fuzzer.cc",
3191   ]
3192   deps = [
3193     "//base",
3194   ]
3195 }
3196
3197 fuzzer_test("base_json_correctness_fuzzer") {
3198   sources = [
3199     "json/json_correctness_fuzzer.cc",
3200   ]
3201   deps = [
3202     ":base",
3203   ]
3204   dict = "//testing/libfuzzer/fuzzers/dicts/json.dict"
3205 }
3206
3207 fuzzer_test("base_json_reader_fuzzer") {
3208   sources = [
3209     "json/json_reader_fuzzer.cc",
3210   ]
3211   deps = [
3212     "//base",
3213   ]
3214   dict = "//testing/libfuzzer/fuzzers/dicts/json.dict"
3215 }
3216
3217 fuzzer_test("base_json_string_escape_fuzzer") {
3218   sources = [
3219     "json/string_escape_fuzzer.cc",
3220   ]
3221   deps = [
3222     "//base",
3223   ]
3224 }
3225
3226 fuzzer_test("string_number_conversions_fuzzer") {
3227   sources = [
3228     "strings/string_number_conversions_fuzzer.cc",
3229   ]
3230   deps = [
3231     "//base",
3232   ]
3233 }
3234
3235 fuzzer_test("string_tokenizer_fuzzer") {
3236   sources = [
3237     "strings/string_tokenizer_fuzzer.cc",
3238   ]
3239   deps = [
3240     "//base",
3241   ]
3242 }
3243
3244 fuzzer_test("utf_string_conversions_fuzzer") {
3245   sources = [
3246     "strings/utf_string_conversions_fuzzer.cc",
3247   ]
3248   deps = [
3249     "//base",
3250   ]
3251 }
3252
3253 # TODO(dyaroshev): remove regression fuzzer, after we run it for a few days
3254 #                  and are confident that the transition was ok.
3255 fuzzer_test("utf_string_conversions_regression_fuzzer") {
3256   sources = [
3257     "strings/old_utf_string_conversions.cc",
3258     "strings/old_utf_string_conversions.h",
3259     "strings/utf_string_conversions_regression_fuzzer.cc",
3260   ]
3261   deps = [
3262     ":base",
3263   ]
3264
3265   libfuzzer_options = [ "max_len=32" ]
3266 }