Fix dereference of NULL host in VersionUpdater::Create.
[chromium-blink-merge.git] / base / BUILD.gn
blobda16ec3bdc35d8884619b8d76777d83c6771b493
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.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/rules.gni")
12 config("base_implementation") {
13   defines = [ "BASE_IMPLEMENTATION" ]
16 if (is_win) {
17   # This is in a separate config so the flags can be applied to dependents.
18   # ldflags in GN aren't automatically inherited.
19   config("base_win_linker_flags") {
20     ldflags = [
21       "/DELAYLOAD:cfgmgr32.dll",
22       "/DELAYLOAD:powrprof.dll",
23       "/DELAYLOAD:setupapi.dll",
24     ]
25   }
28 source_set("base_paths") {
29   sources = [
30     "base_paths.cc",
31     "base_paths.h",
32     "base_paths_android.cc",
33     "base_paths_android.h",
34     "base_paths_mac.h",
35     "base_paths_mac.mm",
36     "base_paths_posix.cc",
37     "base_paths_posix.h",
38     "base_paths_win.cc",
39     "base_paths_win.h",
40   ]
42   if (is_android || is_mac || is_ios) {
43     sources -= [ "base_paths_posix.cc" ]
44   }
46   if (is_nacl) {
47     sources -= [
48       "base_paths.cc",
49       "base_paths_posix.cc",
50     ]
51   }
53   configs += [ ":base_implementation" ]
55   deps = [
56     "//base/memory",
57     "//base/process",
58   ]
60   visibility = [ ":base" ]
63 component("base") {
64   sources = [
65     "allocator/allocator_extension.cc",
66     "allocator/allocator_extension.h",
67     "allocator/type_profiler_control.cc",
68     "allocator/type_profiler_control.h",
69     "android/animation_frame_time_histogram.cc",
70     "android/animation_frame_time_histogram.h",
71     "android/apk_assets.cc",
72     "android/apk_assets.h",
73     "android/application_status_listener.cc",
74     "android/application_status_listener.h",
75     "android/base_jni_onload.cc",
76     "android/base_jni_onload.h",
77     "android/base_jni_registrar.cc",
78     "android/base_jni_registrar.h",
79     "android/build_info.cc",
80     "android/build_info.h",
81     "android/command_line_android.cc",
82     "android/command_line_android.h",
83     "android/content_uri_utils.cc",
84     "android/content_uri_utils.h",
85     "android/cpu_features.cc",
86     "android/cxa_demangle_stub.cc",
87     "android/event_log.cc",
88     "android/event_log.h",
89     "android/field_trial_list.cc",
90     "android/field_trial_list.h",
91     "android/fifo_utils.cc",
92     "android/fifo_utils.h",
93     "android/important_file_writer_android.cc",
94     "android/important_file_writer_android.h",
95     "android/java_handler_thread.cc",
96     "android/java_handler_thread.h",
97     "android/java_runtime.cc",
98     "android/java_runtime.h",
99     "android/jni_android.cc",
100     "android/jni_android.h",
101     "android/jni_array.cc",
102     "android/jni_array.h",
103     "android/jni_registrar.cc",
104     "android/jni_registrar.h",
105     "android/jni_string.cc",
106     "android/jni_string.h",
107     "android/jni_utils.cc",
108     "android/jni_utils.h",
109     "android/jni_weak_ref.cc",
110     "android/jni_weak_ref.h",
111     "android/library_loader/library_load_from_apk_status_codes.h",
112     "android/library_loader/library_loader_hooks.cc",
113     "android/library_loader/library_loader_hooks.h",
114     "android/library_loader/library_prefetcher.cc",
115     "android/library_loader/library_prefetcher.h",
116     "android/locale_utils.cc",
117     "android/locale_utils.h",
118     "android/memory_pressure_listener_android.cc",
119     "android/memory_pressure_listener_android.h",
120     "android/path_service_android.cc",
121     "android/path_service_android.h",
122     "android/path_utils.cc",
123     "android/path_utils.h",
124     "android/record_histogram.cc",
125     "android/record_histogram.h",
126     "android/record_user_action.cc",
127     "android/record_user_action.h",
128     "android/scoped_java_ref.cc",
129     "android/scoped_java_ref.h",
130     "android/sys_utils.cc",
131     "android/sys_utils.h",
132     "android/thread_utils.h",
133     "android/trace_event_binding.cc",
134     "android/trace_event_binding.h",
135     "async_socket_io_handler.h",
136     "async_socket_io_handler_posix.cc",
137     "async_socket_io_handler_win.cc",
138     "at_exit.cc",
139     "at_exit.h",
140     "atomic_ref_count.h",
141     "atomic_sequence_num.h",
142     "atomicops.h",
143     "atomicops_internals_mac.h",
144     "atomicops_internals_portable.h",
145     "atomicops_internals_x86_msvc.h",
146     "auto_reset.h",
147     "barrier_closure.cc",
148     "barrier_closure.h",
149     "base64.cc",
150     "base64.h",
151     "base_export.h",
152     "base_switches.h",
153     "basictypes.h",
154     "big_endian.cc",
155     "big_endian.h",
156     "bind.h",
157     "bind_helpers.cc",
158     "bind_helpers.h",
159     "bind_internal.h",
160     "bind_internal_win.h",
161     "bits.h",
162     "build_time.cc",
163     "build_time.h",
164     "callback.h",
165     "callback_helpers.cc",
166     "callback_helpers.h",
167     "callback_internal.cc",
168     "callback_internal.h",
169     "cancelable_callback.h",
170     "command_line.cc",
171     "command_line.h",
172     "compiler_specific.h",
173     "containers/adapters.h",
174     "containers/hash_tables.h",
175     "containers/linked_list.h",
176     "containers/mru_cache.h",
177     "containers/scoped_ptr_hash_map.h",
178     "containers/scoped_ptr_map.h",
179     "containers/small_map.h",
180     "containers/stack_container.h",
181     "cpu.cc",
182     "cpu.h",
183     "critical_closure.h",
184     "critical_closure_internal_ios.mm",
185     "deferred_sequenced_task_runner.cc",
186     "deferred_sequenced_task_runner.h",
187     "environment.cc",
188     "environment.h",
189     "file_descriptor_posix.h",
190     "file_version_info.h",
191     "file_version_info_mac.h",
192     "file_version_info_mac.mm",
193     "file_version_info_win.cc",
194     "file_version_info_win.h",
195     "files/dir_reader_fallback.h",
196     "files/dir_reader_linux.h",
197     "files/dir_reader_posix.h",
198     "files/file.cc",
199     "files/file_enumerator.cc",
200     "files/file_enumerator.h",
201     "files/file_enumerator_posix.cc",
202     "files/file_enumerator_win.cc",
203     "files/file_path.cc",
204     "files/file_path.h",
205     "files/file_path_constants.cc",
206     "files/file_path_watcher.cc",
207     "files/file_path_watcher.h",
208     "files/file_path_watcher_fsevents.cc",
209     "files/file_path_watcher_fsevents.h",
210     "files/file_path_watcher_kqueue.cc",
211     "files/file_path_watcher_kqueue.h",
212     "files/file_path_watcher_linux.cc",
213     "files/file_path_watcher_mac.cc",
214     "files/file_path_watcher_win.cc",
215     "files/file_posix.cc",
216     "files/file_proxy.cc",
217     "files/file_proxy.h",
218     "files/file_tracing.cc",
219     "files/file_tracing.h",
220     "files/file_util.cc",
221     "files/file_util.h",
222     "files/file_util_android.cc",
223     "files/file_util_linux.cc",
224     "files/file_util_mac.mm",
225     "files/file_util_posix.cc",
226     "files/file_util_proxy.cc",
227     "files/file_util_proxy.h",
228     "files/file_util_win.cc",
229     "files/file_win.cc",
230     "files/important_file_writer.cc",
231     "files/important_file_writer.h",
232     "files/memory_mapped_file.cc",
233     "files/memory_mapped_file.h",
234     "files/memory_mapped_file_posix.cc",
235     "files/memory_mapped_file_win.cc",
236     "files/scoped_file.cc",
237     "files/scoped_file.h",
238     "files/scoped_temp_dir.cc",
239     "files/scoped_temp_dir.h",
240     "format_macros.h",
241     "gtest_prod_util.h",
242     "guid.cc",
243     "guid.h",
244     "guid_posix.cc",
245     "guid_win.cc",
246     "hash.cc",
247     "hash.h",
248     "id_map.h",
249     "ios/crb_protocol_observers.h",
250     "ios/crb_protocol_observers.mm",
251     "ios/device_util.h",
252     "ios/device_util.mm",
253     "ios/ios_util.h",
254     "ios/ios_util.mm",
255     "ios/ns_error_util.h",
256     "ios/ns_error_util.mm",
257     "ios/scoped_critical_action.h",
258     "ios/scoped_critical_action.mm",
259     "ios/weak_nsobject.h",
260     "ios/weak_nsobject.mm",
261     "lazy_instance.cc",
262     "lazy_instance.h",
263     "linux_util.cc",
264     "linux_util.h",
265     "location.cc",
266     "location.h",
267     "logging.cc",
268     "logging.h",
269     "logging_win.cc",
270     "logging_win.h",
271     "mac/authorization_util.h",
272     "mac/authorization_util.mm",
273     "mac/bind_objc_block.h",
274     "mac/bundle_locations.h",
275     "mac/bundle_locations.mm",
276     "mac/call_with_eh_frame.cc",
277     "mac/call_with_eh_frame.h",
278     "mac/call_with_eh_frame_asm.S",
279     "mac/cocoa_protocols.h",
280     "mac/dispatch_source_mach.cc",
281     "mac/dispatch_source_mach.h",
282     "mac/foundation_util.h",
283     "mac/foundation_util.mm",
284     "mac/launch_services_util.cc",
285     "mac/launch_services_util.h",
286     "mac/launchd.cc",
287     "mac/launchd.h",
288     "mac/libdispatch_task_runner.cc",
289     "mac/libdispatch_task_runner.h",
290     "mac/mac_logging.cc",
291     "mac/mac_logging.h",
292     "mac/mac_util.h",
293     "mac/mac_util.mm",
294     "mac/mach_logging.cc",
295     "mac/mach_logging.h",
296     "mac/objc_property_releaser.h",
297     "mac/objc_property_releaser.mm",
298     "mac/os_crash_dumps.cc",
299     "mac/os_crash_dumps.h",
300     "mac/scoped_aedesc.h",
301     "mac/scoped_authorizationref.h",
302     "mac/scoped_block.h",
303     "mac/scoped_cftyperef.h",
304     "mac/scoped_ioobject.h",
305     "mac/scoped_ioplugininterface.h",
306     "mac/scoped_launch_data.h",
307     "mac/scoped_mach_port.cc",
308     "mac/scoped_mach_port.h",
309     "mac/scoped_mach_vm.cc",
310     "mac/scoped_mach_vm.h",
311     "mac/scoped_nsautorelease_pool.h",
312     "mac/scoped_nsautorelease_pool.mm",
313     "mac/scoped_nsobject.h",
314     "mac/scoped_objc_class_swizzler.h",
315     "mac/scoped_objc_class_swizzler.mm",
316     "mac/scoped_sending_event.h",
317     "mac/scoped_sending_event.mm",
318     "mac/sdk_forward_declarations.h",
319     "mac/sdk_forward_declarations.mm",
320     "macros.h",
321     "md5.cc",
322     "md5.h",
323     "message_loop/incoming_task_queue.cc",
324     "message_loop/incoming_task_queue.h",
325     "message_loop/message_loop.cc",
326     "message_loop/message_loop.h",
327     "message_loop/message_loop_task_runner.cc",
328     "message_loop/message_loop_task_runner.h",
329     "message_loop/message_pump.cc",
330     "message_loop/message_pump.h",
331     "message_loop/message_pump_android.cc",
332     "message_loop/message_pump_android.h",
333     "message_loop/message_pump_default.cc",
334     "message_loop/message_pump_default.h",
335     "message_loop/message_pump_glib.cc",
336     "message_loop/message_pump_glib.h",
337     "message_loop/message_pump_io_ios.cc",
338     "message_loop/message_pump_io_ios.h",
339     "message_loop/message_pump_libevent.cc",
340     "message_loop/message_pump_libevent.h",
341     "message_loop/message_pump_mac.h",
342     "message_loop/message_pump_mac.mm",
343     "message_loop/message_pump_win.cc",
344     "message_loop/message_pump_win.h",
345     "move.h",
346     "native_library.h",
347     "native_library_ios.mm",
348     "native_library_mac.mm",
349     "native_library_posix.cc",
350     "native_library_win.cc",
351     "nix/mime_util_xdg.cc",
352     "nix/mime_util_xdg.h",
353     "nix/xdg_util.cc",
354     "nix/xdg_util.h",
355     "numerics/safe_conversions.h",
356     "numerics/safe_conversions_impl.h",
357     "numerics/safe_math.h",
358     "numerics/safe_math_impl.h",
359     "observer_list.h",
360     "observer_list_threadsafe.h",
361     "os_compat_android.cc",
362     "os_compat_android.h",
363     "os_compat_nacl.cc",
364     "os_compat_nacl.h",
365     "path_service.cc",
366     "path_service.h",
367     "pending_task.cc",
368     "pending_task.h",
369     "pickle.cc",
370     "pickle.h",
371     "posix/eintr_wrapper.h",
372     "posix/file_descriptor_shuffle.cc",
373     "posix/global_descriptors.cc",
374     "posix/global_descriptors.h",
375     "posix/safe_strerror.cc",
376     "posix/safe_strerror.h",
377     "posix/unix_domain_socket_linux.cc",
378     "posix/unix_domain_socket_linux.h",
379     "power_monitor/power_monitor.cc",
380     "power_monitor/power_monitor.h",
381     "power_monitor/power_monitor_device_source.cc",
382     "power_monitor/power_monitor_device_source.h",
383     "power_monitor/power_monitor_device_source_android.cc",
384     "power_monitor/power_monitor_device_source_android.h",
385     "power_monitor/power_monitor_device_source_chromeos.cc",
386     "power_monitor/power_monitor_device_source_ios.mm",
387     "power_monitor/power_monitor_device_source_mac.mm",
388     "power_monitor/power_monitor_device_source_posix.cc",
389     "power_monitor/power_monitor_device_source_win.cc",
390     "power_monitor/power_monitor_source.cc",
391     "power_monitor/power_monitor_source.h",
392     "power_monitor/power_observer.h",
393     "profiler/alternate_timer.cc",
394     "profiler/alternate_timer.h",
395     "profiler/native_stack_sampler.cc",
396     "profiler/native_stack_sampler.h",
397     "profiler/native_stack_sampler_posix.cc",
398     "profiler/native_stack_sampler_win.cc",
399     "profiler/scoped_profile.cc",
400     "profiler/scoped_profile.h",
401     "profiler/scoped_tracker.cc",
402     "profiler/scoped_tracker.h",
403     "profiler/stack_sampling_profiler.cc",
404     "profiler/stack_sampling_profiler.h",
405     "profiler/tracked_time.cc",
406     "profiler/tracked_time.h",
407     "rand_util.cc",
408     "rand_util.h",
409     "rand_util_nacl.cc",
410     "rand_util_posix.cc",
411     "rand_util_win.cc",
412     "run_loop.cc",
413     "run_loop.h",
414     "scoped_generic.h",
415     "scoped_native_library.cc",
416     "scoped_native_library.h",
417     "scoped_observer.h",
418     "sequence_checker.h",
419     "sequence_checker_impl.cc",
420     "sequence_checker_impl.h",
421     "sequenced_task_runner.cc",
422     "sequenced_task_runner.h",
423     "sequenced_task_runner_helpers.h",
424     "sha1.h",
425     "sha1_portable.cc",
426     "sha1_win.cc",
427     "single_thread_task_runner.h",
428     "stl_util.h",
429     "strings/latin1_string_conversions.cc",
430     "strings/latin1_string_conversions.h",
431     "strings/nullable_string16.cc",
432     "strings/nullable_string16.h",
433     "strings/pattern.cc",
434     "strings/pattern.h",
435     "strings/safe_sprintf.cc",
436     "strings/safe_sprintf.h",
437     "strings/string16.cc",
438     "strings/string16.h",
439     "strings/string_number_conversions.cc",
440     "strings/string_number_conversions.h",
441     "strings/string_piece.cc",
442     "strings/string_piece.h",
443     "strings/string_split.cc",
444     "strings/string_split.h",
445     "strings/string_tokenizer.h",
446     "strings/string_util.cc",
447     "strings/string_util.h",
448     "strings/string_util_constants.cc",
449     "strings/string_util_posix.h",
450     "strings/string_util_win.h",
451     "strings/stringize_macros.h",
452     "strings/stringprintf.cc",
453     "strings/stringprintf.h",
454     "strings/sys_string_conversions.h",
455     "strings/sys_string_conversions_mac.mm",
456     "strings/sys_string_conversions_posix.cc",
457     "strings/sys_string_conversions_win.cc",
458     "strings/utf_offset_string_conversions.cc",
459     "strings/utf_offset_string_conversions.h",
460     "strings/utf_string_conversion_utils.cc",
461     "strings/utf_string_conversion_utils.h",
462     "strings/utf_string_conversions.cc",
463     "strings/utf_string_conversions.h",
464     "supports_user_data.cc",
465     "supports_user_data.h",
466     "sync_socket.h",
467     "sync_socket_posix.cc",
468     "sync_socket_win.cc",
469     "synchronization/cancellation_flag.cc",
470     "synchronization/cancellation_flag.h",
471     "synchronization/condition_variable.h",
472     "synchronization/condition_variable_posix.cc",
473     "synchronization/condition_variable_win.cc",
474     "synchronization/lock.cc",
475     "synchronization/lock.h",
476     "synchronization/lock_impl.h",
477     "synchronization/lock_impl_posix.cc",
478     "synchronization/lock_impl_win.cc",
479     "synchronization/spin_wait.h",
480     "synchronization/waitable_event.h",
481     "synchronization/waitable_event_posix.cc",
482     "synchronization/waitable_event_watcher.h",
483     "synchronization/waitable_event_watcher_posix.cc",
484     "synchronization/waitable_event_watcher_win.cc",
485     "synchronization/waitable_event_win.cc",
486     "sys_byteorder.h",
487     "sys_info.cc",
488     "sys_info.h",
489     "sys_info_android.cc",
490     "sys_info_chromeos.cc",
491     "sys_info_freebsd.cc",
492     "sys_info_ios.mm",
493     "sys_info_linux.cc",
494     "sys_info_mac.cc",
495     "sys_info_openbsd.cc",
496     "sys_info_posix.cc",
497     "sys_info_win.cc",
498     "system_monitor/system_monitor.cc",
499     "system_monitor/system_monitor.h",
500     "task/cancelable_task_tracker.cc",
501     "task/cancelable_task_tracker.h",
502     "task_runner.cc",
503     "task_runner.h",
504     "task_runner_util.h",
505     "template_util.h",
506     "third_party/dmg_fp/dmg_fp.h",
507     "third_party/dmg_fp/dtoa_wrapper.cc",
508     "third_party/dmg_fp/g_fmt.cc",
509     "third_party/icu/icu_utf.cc",
510     "third_party/icu/icu_utf.h",
511     "third_party/nspr/prtime.cc",
512     "third_party/nspr/prtime.h",
513     "third_party/superfasthash/superfasthash.c",
514     "thread_task_runner_handle.cc",
515     "thread_task_runner_handle.h",
516     "threading/non_thread_safe.h",
517     "threading/non_thread_safe_impl.cc",
518     "threading/non_thread_safe_impl.h",
519     "threading/platform_thread.h",
520     "threading/platform_thread_android.cc",
521     "threading/platform_thread_internal_posix.cc",
522     "threading/platform_thread_internal_posix.h",
523     "threading/platform_thread_linux.cc",
524     "threading/platform_thread_mac.mm",
525     "threading/platform_thread_posix.cc",
526     "threading/platform_thread_win.cc",
527     "threading/post_task_and_reply_impl.cc",
528     "threading/post_task_and_reply_impl.h",
529     "threading/sequenced_worker_pool.cc",
530     "threading/sequenced_worker_pool.h",
531     "threading/simple_thread.cc",
532     "threading/simple_thread.h",
533     "threading/thread.cc",
534     "threading/thread.h",
535     "threading/thread_checker.h",
536     "threading/thread_checker_impl.cc",
537     "threading/thread_checker_impl.h",
538     "threading/thread_collision_warner.cc",
539     "threading/thread_collision_warner.h",
540     "threading/thread_id_name_manager.cc",
541     "threading/thread_id_name_manager.h",
542     "threading/thread_local.h",
543     "threading/thread_local_android.cc",
544     "threading/thread_local_posix.cc",
545     "threading/thread_local_storage.cc",
546     "threading/thread_local_storage.h",
547     "threading/thread_local_storage_posix.cc",
548     "threading/thread_local_storage_win.cc",
549     "threading/thread_local_win.cc",
550     "threading/thread_restrictions.cc",
551     "threading/thread_restrictions.h",
552     "threading/watchdog.cc",
553     "threading/watchdog.h",
554     "threading/worker_pool.cc",
555     "threading/worker_pool.h",
556     "threading/worker_pool_posix.cc",
557     "threading/worker_pool_posix.h",
558     "threading/worker_pool_win.cc",
559     "time/clock.cc",
560     "time/clock.h",
561     "time/default_clock.cc",
562     "time/default_clock.h",
563     "time/default_tick_clock.cc",
564     "time/default_tick_clock.h",
565     "time/tick_clock.cc",
566     "time/tick_clock.h",
567     "time/time.cc",
568     "time/time.h",
569     "time/time_mac.cc",
570     "time/time_posix.cc",
571     "time/time_win.cc",
572     "timer/elapsed_timer.cc",
573     "timer/elapsed_timer.h",
574     "timer/hi_res_timer_manager.h",
575     "timer/hi_res_timer_manager_posix.cc",
576     "timer/hi_res_timer_manager_win.cc",
577     "timer/mock_timer.cc",
578     "timer/mock_timer.h",
579     "timer/timer.cc",
580     "timer/timer.h",
581     "tracked_objects.cc",
582     "tracked_objects.h",
583     "tracking_info.cc",
584     "tracking_info.h",
585     "tuple.h",
586     "value_conversions.cc",
587     "value_conversions.h",
588     "values.cc",
589     "values.h",
590     "version.cc",
591     "version.h",
592     "vlog.cc",
593     "vlog.h",
594     "win/enum_variant.cc",
595     "win/enum_variant.h",
596     "win/event_trace_consumer.h",
597     "win/event_trace_controller.cc",
598     "win/event_trace_controller.h",
599     "win/event_trace_provider.cc",
600     "win/event_trace_provider.h",
601     "win/i18n.cc",
602     "win/i18n.h",
603     "win/iat_patch_function.cc",
604     "win/iat_patch_function.h",
605     "win/iunknown_impl.cc",
606     "win/iunknown_impl.h",
607     "win/message_window.cc",
608     "win/message_window.h",
609     "win/metro.cc",
610     "win/metro.h",
611     "win/object_watcher.cc",
612     "win/object_watcher.h",
613     "win/registry.cc",
614     "win/registry.h",
615     "win/resource_util.cc",
616     "win/resource_util.h",
617     "win/scoped_bstr.cc",
618     "win/scoped_bstr.h",
619     "win/scoped_co_mem.h",
620     "win/scoped_com_initializer.h",
621     "win/scoped_comptr.h",
622     "win/scoped_gdi_object.h",
623     "win/scoped_handle.cc",
624     "win/scoped_handle.h",
625     "win/scoped_hdc.h",
626     "win/scoped_hglobal.h",
627     "win/scoped_process_information.cc",
628     "win/scoped_process_information.h",
629     "win/scoped_propvariant.h",
630     "win/scoped_select_object.h",
631     "win/scoped_variant.cc",
632     "win/scoped_variant.h",
633     "win/shortcut.cc",
634     "win/shortcut.h",
635     "win/startup_information.cc",
636     "win/startup_information.h",
637     "win/win_util.cc",
638     "win/win_util.h",
639     "win/windows_version.cc",
640     "win/windows_version.h",
641     "win/wrapped_window_proc.cc",
642     "win/wrapped_window_proc.h",
643   ]
645   if (is_ios) {
646     sources += [ "process/memory_stubs.cc" ]
647     sources -= [
648       "message_loop/message_pump_libevent.cc",
649       "message_loop/message_pump_libevent.h",
650     ]
652     set_sources_assignment_filter([])
653     sources += [ "files/file_path_watcher_mac.cc" ]
654     set_sources_assignment_filter(sources_assignment_filter)
655   }
657   sources -= [
658     "sys_info_freebsd.cc",
659     "sys_info_openbsd.cc",
660   ]
662   data = []
664   configs += [
665     ":base_implementation",
666     "//build/config:precompiled_headers",
667   ]
669   deps = [
670     ":base_static",
671     "//base/allocator:allocator_extension_thunks",
672     "//base/third_party/dynamic_annotations",
673     "//third_party/modp_b64",
674   ]
676   public_deps = [
677     ":base_paths",
678     "//base/debug",
679     "//base/json",
680     "//base/memory",
681     "//base/metrics",
682     "//base/process",
683     "//base/trace_event",
684   ]
686   # Allow more direct string conversions on platforms with native utf8
687   # strings
688   if (is_mac || is_ios || is_chromeos) {
689     defines = [ "SYSTEM_NATIVE_UTF8" ]
690   }
692   if (is_android) {
693     sources -= [ "power_monitor/power_monitor_device_source_posix.cc" ]
695     # Android uses some Linux sources, put those back.
696     set_sources_assignment_filter([])
697     sources += [
698       "files/file_path_watcher_linux.cc",
699       "posix/unix_domain_socket_linux.cc",
700       "sys_info_linux.cc",
701     ]
702     set_sources_assignment_filter(sources_assignment_filter)
704     deps += [
705       ":base_jni_headers",
706       "//third_party/ashmem",
707       "//third_party/android_tools:cpu_features",
708     ]
710     # logging.cc uses the Android logging library.
711     libs = [ "log" ]
712   }
714   if (is_chromeos) {
715     sources -= [ "power_monitor/power_monitor_device_source_posix.cc" ]
716   }
718   if (is_nacl) {
719     # We reset sources_assignment_filter in order to explicitly include
720     # the linux file (which would otherwise be filtered out).
721     set_sources_assignment_filter([])
722     sources += [
723       "files/file_path_watcher_stub.cc",
724       "sync_socket_nacl.cc",
725       "threading/platform_thread_linux.cc",
726     ]
727     set_sources_assignment_filter(sources_assignment_filter)
729     sources -= [
730       "allocator/type_profiler_control.cc",
731       "allocator/type_profiler_control.h",
732       "async_socket_io_handler_posix.cc",
733       "cpu.cc",
734       "files/file_enumerator_posix.cc",
735       "files/file_proxy.cc",
736       "files/file_util.cc",
737       "files/file_util_posix.cc",
738       "files/file_util_proxy.cc",
739       "files/important_file_writer.cc",
740       "files/important_file_writer.h",
741       "files/scoped_temp_dir.cc",
742       "message_loop/message_pump_libevent.cc",
743       "native_library_posix.cc",
744       "path_service.cc",
745       "rand_util_posix.cc",
746       "scoped_native_library.cc",
747       "sync_socket_posix.cc",
748       "sys_info.cc",
749       "sys_info_posix.cc",
750     ]
751   } else {
752     # Remove NaCl stuff.
753     sources -= [
754       "os_compat_nacl.cc",
755       "os_compat_nacl.h",
756       "rand_util_nacl.cc",
757     ]
758   }
760   # Windows.
761   if (is_win) {
762     sources -= [
763       "message_loop/message_pump_libevent.cc",
764       "strings/string16.cc",
766       # Not using sha1_win.cc because it may have caused a
767       # regression to page cycler moz.
768       "sha1_win.cc",
769     ]
771     # Required for base/stack_trace_win.cc to symbolize correctly.
772     data += [ "$root_build_dir/dbghelp.dll" ]
774     if (is_component_build) {
775       # Copy the VS runtime DLLs into the isolate so that they don't have to be
776       # preinstalled on the target machine. The debug runtimes have a "d" at
777       # the end.
778       if (is_debug) {
779         vcrt_suffix = "d"
780       } else {
781         vcrt_suffix = ""
782       }
784       # These runtime files are copied to the output directory by the
785       # vs_toolchain script that runs as part of toolchain configuration.
786       data += [
787         "$root_out_dir/msvcp120${vcrt_suffix}.dll",
788         "$root_out_dir/msvcr120${vcrt_suffix}.dll",
789       ]
790       if (is_asan) {
791         data += [ "//third_party/llvm-build/Release+Asserts/lib/clang/3.8.0/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
792       }
793     }
795     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
796     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
798     libs = [
799       "cfgmgr32.lib",
800       "netapi32.lib",
801       "powrprof.lib",
802       "setupapi.lib",
803     ]
804     all_dependent_configs = [ ":base_win_linker_flags" ]
805   } else if (!is_nacl) {
806     # Non-Windows.
807     deps += [ "//third_party/libevent" ]
808   }
810   # Mac.
811   if (is_mac || is_ios) {
812     # Common Desktop / iOS excludes
813     sources -= [
814       "native_library_posix.cc",
815       "strings/sys_string_conversions_posix.cc",
816       "threading/platform_thread_internal_posix.cc",
817     ]
819     if (is_asan) {
820       # TODO(GYP) hook up asan on Mac. GYP has this extra dylib:
821       #data += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
822     }
824     if (is_ios) {
825       sources -= [
826         "files/file_path_watcher_fsevents.cc",
827         "files/file_path_watcher_fsevents.h",
828       ]
829     }
830   } else {
831     # Non-Mac.
832     sources -= [
833       "files/file_path_watcher_fsevents.cc",
834       "files/file_path_watcher_fsevents.h",
835       "files/file_path_watcher_kqueue.cc",
836       "files/file_path_watcher_kqueue.h",
837     ]
838   }
840   # Linux.
841   if (is_linux) {
842     if (is_asan || is_lsan || is_msan || is_tsan) {
843       # For llvm-sanitizer.
844       data += [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ]
845     }
847     # TODO(brettw) this will need to be parameterized at some point.
848     linux_configs = []
849     if (use_glib) {
850       linux_configs += [ "//build/config/linux:glib" ]
851     }
853     configs += linux_configs
854     all_dependent_configs = linux_configs
856     # These dependencies are not required on Android, and in the case
857     # of xdg_mime must be excluded due to licensing restrictions.
858     deps += [
859       "//base/third_party/xdg_mime",
860       "//base/third_party/xdg_user_dirs",
861     ]
862   } else {
863     # Non-Linux.
864     sources -= [
865       "nix/mime_util_xdg.cc",
866       "nix/mime_util_xdg.h",
867       "nix/xdg_util.cc",
868       "nix/xdg_util.h",
869     ]
871     if (!is_android) {
872       sources -= [
873         "linux_util.cc",
874         "linux_util.h",
875       ]
876     }
877   }
879   # iOS
880   if (is_ios) {
881     set_sources_assignment_filter([])
883     sources += [
884       "atomicops_internals_mac.h",
885       "base_paths_mac.h",
886       "base_paths_mac.mm",
887       "file_version_info_mac.h",
888       "file_version_info_mac.mm",
889       "files/file_util_mac.mm",
890       "mac/bundle_locations.h",
891       "mac/bundle_locations.mm",
892       "mac/call_with_eh_frame.cc",
893       "mac/call_with_eh_frame.h",
894       "mac/foundation_util.h",
895       "mac/foundation_util.mm",
896       "mac/mac_logging.cc",
897       "mac/mac_logging.h",
898       "mac/mach_logging.cc",
899       "mac/mach_logging.h",
900       "mac/objc_property_releaser.h",
901       "mac/objc_property_releaser.mm",
902       "mac/scoped_mach_port.cc",
903       "mac/scoped_mach_port.h",
904       "mac/scoped_mach_vm.cc",
905       "mac/scoped_mach_vm.h",
906       "mac/scoped_nsautorelease_pool.h",
907       "mac/scoped_nsautorelease_pool.mm",
908       "mac/scoped_nsobject.h",
909       "mac/scoped_objc_class_swizzler.h",
910       "mac/scoped_objc_class_swizzler.mm",
911       "message_loop/message_pump_mac.h",
912       "message_loop/message_pump_mac.mm",
913       "strings/sys_string_conversions_mac.mm",
914       "threading/platform_thread_mac.mm",
915       "time/time_mac.cc",
916     ]
918     set_sources_assignment_filter(sources_assignment_filter)
919   }
921   if (!use_glib) {
922     sources -= [
923       "message_loop/message_pump_glib.cc",
924       "message_loop/message_pump_glib.h",
925     ]
926   }
928   if (is_asan || is_lsan || is_msan || is_tsan) {
929     data += [ "//tools/valgrind/asan/" ]
930     if (is_win) {
931       data +=
932           [ "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer.exe" ]
933     } else {
934       data += [ "//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer" ]
935     }
936   }
938   configs += [ "//build/config/compiler:wexit_time_destructors" ]
939   if (!is_debug) {
940     configs -= [ "//build/config/compiler:optimize" ]
941     configs += [ "//build/config/compiler:optimize_max" ]
942   }
944   allow_circular_includes_from = public_deps
947 # This is the subset of files from base that should not be used with a dynamic
948 # library. Note that this library cannot depend on base because base depends on
949 # base_static.
950 source_set("base_static") {
951   sources = [
952     "base_switches.cc",
953     "base_switches.h",
954     "win/pe_image.cc",
955     "win/pe_image.h",
956   ]
958   if (!is_debug) {
959     configs -= [ "//build/config/compiler:optimize" ]
960     configs += [ "//build/config/compiler:optimize_max" ]
961   }
964 component("i18n") {
965   output_name = "base_i18n"
966   sources = [
967     "i18n/base_i18n_export.h",
968     "i18n/bidi_line_iterator.cc",
969     "i18n/bidi_line_iterator.h",
970     "i18n/break_iterator.cc",
971     "i18n/break_iterator.h",
972     "i18n/case_conversion.cc",
973     "i18n/case_conversion.h",
974     "i18n/char_iterator.cc",
975     "i18n/char_iterator.h",
976     "i18n/file_util_icu.cc",
977     "i18n/file_util_icu.h",
978     "i18n/i18n_constants.cc",
979     "i18n/i18n_constants.h",
980     "i18n/icu_encoding_detection.cc",
981     "i18n/icu_encoding_detection.h",
982     "i18n/icu_string_conversions.cc",
983     "i18n/icu_string_conversions.h",
984     "i18n/icu_util.cc",
985     "i18n/icu_util.h",
986     "i18n/number_formatting.cc",
987     "i18n/number_formatting.h",
988     "i18n/rtl.cc",
989     "i18n/rtl.h",
990     "i18n/streaming_utf8_validator.cc",
991     "i18n/streaming_utf8_validator.h",
992     "i18n/string_compare.cc",
993     "i18n/string_compare.h",
994     "i18n/string_search.cc",
995     "i18n/string_search.h",
996     "i18n/time_formatting.cc",
997     "i18n/time_formatting.h",
998     "i18n/timezone.cc",
999     "i18n/timezone.h",
1000     "i18n/utf8_validator_tables.cc",
1001     "i18n/utf8_validator_tables.h",
1002   ]
1003   defines = [ "BASE_I18N_IMPLEMENTATION" ]
1004   configs += [ "//build/config/compiler:wexit_time_destructors" ]
1005   deps = [
1006     ":base",
1007     "//base/third_party/dynamic_annotations",
1008     "//third_party/icu",
1009   ]
1011   if (!is_debug) {
1012     configs -= [ "//build/config/compiler:optimize" ]
1013     configs += [ "//build/config/compiler:optimize_max" ]
1014   }
1016   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1017   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1020 if (is_ios || is_win || (is_linux && !is_chromeos)) {
1021   # TODO(GYP): Figure out which of these work and are needed on other platforms.
1022   test("base_perftests") {
1023     sources = [
1024       "message_loop/message_pump_perftest.cc",
1026       # "test/run_all_unittests.cc",
1027       "threading/thread_perftest.cc",
1028     ]
1029     deps = [
1030       ":base",
1031       "//base/test:test_support",
1032       "//base/test:test_support_perf",
1033       "//testing/perf",
1034       "//testing/gtest",
1035     ]
1037     if (is_android) {
1038       deps += [ "//testing/android/native_test:native_test_native_code" ]
1039     }
1040   }
1042   test("base_i18n_perftests") {
1043     sources = [
1044       "i18n/streaming_utf8_validator_perftest.cc",
1045     ]
1046     deps = [
1047       ":base",
1048       ":i18n",
1049       "//base/test:test_support",
1050       "//base/test:test_support_perf",
1051       "//testing/gtest",
1052     ]
1053   }
1055   if (!is_ios) {
1056     executable("build_utf8_validator_tables") {
1057       sources = [
1058         "i18n/build_utf8_validator_tables.cc",
1059       ]
1060       deps = [
1061         ":base",
1062         "//third_party/icu:icuuc",
1063       ]
1064     }
1066     executable("check_example") {
1067       sources = [
1068         "check_example.cc",
1069       ]
1070       deps = [
1071         ":base",
1072       ]
1073     }
1074   }
1077 component("prefs") {
1078   sources = [
1079     "prefs/default_pref_store.cc",
1080     "prefs/default_pref_store.h",
1081     "prefs/json_pref_store.cc",
1082     "prefs/json_pref_store.h",
1083     "prefs/overlay_user_pref_store.cc",
1084     "prefs/overlay_user_pref_store.h",
1085     "prefs/pref_change_registrar.cc",
1086     "prefs/pref_change_registrar.h",
1087     "prefs/pref_member.cc",
1088     "prefs/pref_member.h",
1089     "prefs/pref_notifier_impl.cc",
1090     "prefs/pref_notifier_impl.h",
1091     "prefs/pref_registry.cc",
1092     "prefs/pref_registry.h",
1093     "prefs/pref_registry_simple.cc",
1094     "prefs/pref_registry_simple.h",
1095     "prefs/pref_service.cc",
1096     "prefs/pref_service.h",
1097     "prefs/pref_service_factory.cc",
1098     "prefs/pref_service_factory.h",
1099     "prefs/pref_store.cc",
1100     "prefs/pref_store.h",
1101     "prefs/pref_value_map.cc",
1102     "prefs/pref_value_map.h",
1103     "prefs/pref_value_store.cc",
1104     "prefs/pref_value_store.h",
1105     "prefs/scoped_user_pref_update.cc",
1106     "prefs/scoped_user_pref_update.h",
1107     "prefs/value_map_pref_store.cc",
1108     "prefs/value_map_pref_store.h",
1109   ]
1110   if (!is_ios) {
1111     sources += [
1112       "prefs/base_prefs_export.h",
1113       "prefs/persistent_pref_store.h",
1114       "prefs/pref_filter.h",
1115       "prefs/pref_notifier.h",
1116       "prefs/pref_observer.h",
1117       "prefs/writeable_pref_store.h",
1118     ]
1119   }
1121   defines = [ "BASE_PREFS_IMPLEMENTATION" ]
1123   deps = [
1124     ":base",
1125   ]
1127   if (!is_debug) {
1128     configs -= [ "//build/config/compiler:optimize" ]
1129     configs += [ "//build/config/compiler:optimize_max" ]
1130   }
1133 source_set("prefs_test_support") {
1134   testonly = true
1135   sources = [
1136     "prefs/mock_pref_change_callback.cc",
1137     "prefs/mock_pref_change_callback.h",
1138     "prefs/pref_store_observer_mock.cc",
1139     "prefs/pref_store_observer_mock.h",
1140     "prefs/testing_pref_service.cc",
1141     "prefs/testing_pref_service.h",
1142     "prefs/testing_pref_store.cc",
1143     "prefs/testing_pref_store.h",
1144   ]
1146   public_deps = [
1147     ":prefs",
1148   ]
1149   deps = [
1150     ":base",
1151     "//testing/gmock",
1152     "//testing/gtest",
1153   ]
1156 source_set("message_loop_tests") {
1157   testonly = true
1158   sources = [
1159     "message_loop/message_loop_test.cc",
1160     "message_loop/message_loop_test.h",
1161   ]
1163   deps = [
1164     ":base",
1165     "//testing/gtest",
1166   ]
1169 if (is_win) {
1170   # Target to manually rebuild pe_image_test.dll which is checked into
1171   # base/test/data/pe_image.
1172   shared_library("pe_image_test") {
1173     sources = [
1174       "win/pe_image_test.cc",
1175     ]
1176     ldflags = [
1177       "/DELAYLOAD:cfgmgr32.dll",
1178       "/DELAYLOAD:shell32.dll",
1179       "/SUBSYSTEM:WINDOWS",
1180     ]
1181     libs = [
1182       "cfgmgr32.lib",
1183       "shell32.lib",
1184     ]
1185   }
1188 # TODO(GYP): Delete this after we've converted everything to GN.
1189 # The _run targets exist only for compatibility w/ GYP.
1190 group("base_unittests_run") {
1191   testonly = true
1192   deps = [
1193     ":base_unittests",
1194   ]
1197 test("base_unittests") {
1198   sources = [
1199     "android/application_status_listener_unittest.cc",
1200     "android/content_uri_utils_unittest.cc",
1201     "android/jni_android_unittest.cc",
1202     "android/jni_array_unittest.cc",
1203     "android/jni_string_unittest.cc",
1204     "android/library_loader/library_prefetcher_unittest.cc",
1205     "android/path_utils_unittest.cc",
1206     "android/scoped_java_ref_unittest.cc",
1207     "android/sys_utils_unittest.cc",
1208     "async_socket_io_handler_unittest.cc",
1209     "at_exit_unittest.cc",
1210     "atomicops_unittest.cc",
1211     "barrier_closure_unittest.cc",
1212     "base64_unittest.cc",
1213     "big_endian_unittest.cc",
1214     "bind_unittest.cc",
1215     "bind_unittest.nc",
1216     "bits_unittest.cc",
1217     "build_time_unittest.cc",
1218     "callback_helpers_unittest.cc",
1219     "callback_list_unittest.cc",
1220     "callback_list_unittest.nc",
1221     "callback_unittest.cc",
1222     "callback_unittest.nc",
1223     "cancelable_callback_unittest.cc",
1224     "command_line_unittest.cc",
1225     "containers/adapters_unittest.cc",
1226     "containers/hash_tables_unittest.cc",
1227     "containers/linked_list_unittest.cc",
1228     "containers/mru_cache_unittest.cc",
1229     "containers/scoped_ptr_hash_map_unittest.cc",
1230     "containers/scoped_ptr_map_unittest.cc",
1231     "containers/small_map_unittest.cc",
1232     "containers/stack_container_unittest.cc",
1233     "cpu_unittest.cc",
1234     "debug/crash_logging_unittest.cc",
1235     "debug/debugger_unittest.cc",
1236     "debug/leak_tracker_unittest.cc",
1237     "debug/proc_maps_linux_unittest.cc",
1238     "debug/stack_trace_unittest.cc",
1239     "debug/task_annotator_unittest.cc",
1240     "deferred_sequenced_task_runner_unittest.cc",
1241     "environment_unittest.cc",
1242     "file_version_info_unittest.cc",
1243     "files/dir_reader_posix_unittest.cc",
1244     "files/file_path_unittest.cc",
1245     "files/file_path_watcher_unittest.cc",
1246     "files/file_proxy_unittest.cc",
1247     "files/file_unittest.cc",
1248     "files/file_util_proxy_unittest.cc",
1249     "files/file_util_unittest.cc",
1250     "files/important_file_writer_unittest.cc",
1251     "files/scoped_temp_dir_unittest.cc",
1252     "gmock_unittest.cc",
1253     "guid_unittest.cc",
1254     "hash_unittest.cc",
1255     "i18n/break_iterator_unittest.cc",
1256     "i18n/case_conversion_unittest.cc",
1257     "i18n/char_iterator_unittest.cc",
1258     "i18n/file_util_icu_unittest.cc",
1259     "i18n/icu_string_conversions_unittest.cc",
1260     "i18n/number_formatting_unittest.cc",
1261     "i18n/rtl_unittest.cc",
1262     "i18n/streaming_utf8_validator_unittest.cc",
1263     "i18n/string_search_unittest.cc",
1264     "i18n/time_formatting_unittest.cc",
1265     "i18n/timezone_unittest.cc",
1266     "id_map_unittest.cc",
1267     "ios/device_util_unittest.mm",
1268     "ios/weak_nsobject_unittest.mm",
1269     "json/json_parser_unittest.cc",
1270     "json/json_reader_unittest.cc",
1271     "json/json_value_converter_unittest.cc",
1272     "json/json_value_serializer_unittest.cc",
1273     "json/json_writer_unittest.cc",
1274     "json/string_escape_unittest.cc",
1275     "lazy_instance_unittest.cc",
1276     "logging_unittest.cc",
1277     "mac/bind_objc_block_unittest.mm",
1278     "mac/call_with_eh_frame_unittest.mm",
1279     "mac/dispatch_source_mach_unittest.cc",
1280     "mac/foundation_util_unittest.mm",
1281     "mac/libdispatch_task_runner_unittest.cc",
1282     "mac/mac_util_unittest.mm",
1283     "mac/objc_property_releaser_unittest.mm",
1284     "mac/scoped_nsobject_unittest.mm",
1285     "mac/scoped_objc_class_swizzler_unittest.mm",
1286     "mac/scoped_sending_event_unittest.mm",
1287     "md5_unittest.cc",
1288     "memory/aligned_memory_unittest.cc",
1289     "memory/discardable_shared_memory_unittest.cc",
1290     "memory/linked_ptr_unittest.cc",
1291     "memory/memory_pressure_monitor_chromeos_unittest.cc",
1292     "memory/memory_pressure_monitor_win_unittest.cc",
1293     "memory/ref_counted_memory_unittest.cc",
1294     "memory/ref_counted_unittest.cc",
1295     "memory/scoped_ptr_unittest.cc",
1296     "memory/scoped_ptr_unittest.nc",
1297     "memory/scoped_vector_unittest.cc",
1298     "memory/shared_memory_unittest.cc",
1299     "memory/singleton_unittest.cc",
1300     "memory/weak_ptr_unittest.cc",
1301     "memory/weak_ptr_unittest.nc",
1302     "message_loop/message_loop_task_runner_unittest.cc",
1303     "message_loop/message_loop_unittest.cc",
1304     "message_loop/message_pump_glib_unittest.cc",
1305     "message_loop/message_pump_io_ios_unittest.cc",
1306     "metrics/bucket_ranges_unittest.cc",
1307     "metrics/field_trial_unittest.cc",
1308     "metrics/histogram_base_unittest.cc",
1309     "metrics/histogram_delta_serialization_unittest.cc",
1310     "metrics/histogram_snapshot_manager_unittest.cc",
1311     "metrics/histogram_unittest.cc",
1312     "metrics/sample_map_unittest.cc",
1313     "metrics/sample_vector_unittest.cc",
1314     "metrics/sparse_histogram_unittest.cc",
1315     "metrics/statistics_recorder_unittest.cc",
1316     "move_unittest.cc",
1317     "numerics/safe_numerics_unittest.cc",
1318     "observer_list_unittest.cc",
1319     "os_compat_android_unittest.cc",
1320     "path_service_unittest.cc",
1321     "pickle_unittest.cc",
1322     "posix/file_descriptor_shuffle_unittest.cc",
1323     "posix/unix_domain_socket_linux_unittest.cc",
1324     "power_monitor/power_monitor_unittest.cc",
1325     "prefs/default_pref_store_unittest.cc",
1326     "prefs/json_pref_store_unittest.cc",
1327     "prefs/overlay_user_pref_store_unittest.cc",
1328     "prefs/pref_change_registrar_unittest.cc",
1329     "prefs/pref_member_unittest.cc",
1330     "prefs/pref_notifier_impl_unittest.cc",
1331     "prefs/pref_service_unittest.cc",
1332     "prefs/pref_value_map_unittest.cc",
1333     "prefs/pref_value_store_unittest.cc",
1334     "prefs/scoped_user_pref_update_unittest.cc",
1335     "process/memory_unittest.cc",
1336     "process/memory_unittest_mac.h",
1337     "process/memory_unittest_mac.mm",
1338     "process/process_metrics_unittest.cc",
1339     "process/process_metrics_unittest_ios.cc",
1340     "process/process_unittest.cc",
1341     "process/process_util_unittest.cc",
1342     "process/process_util_unittest_ios.cc",
1343     "profiler/stack_sampling_profiler_unittest.cc",
1344     "profiler/tracked_time_unittest.cc",
1345     "rand_util_unittest.cc",
1346     "scoped_clear_errno_unittest.cc",
1347     "scoped_generic_unittest.cc",
1348     "scoped_native_library_unittest.cc",
1349     "security_unittest.cc",
1350     "sequence_checker_unittest.cc",
1351     "sha1_unittest.cc",
1352     "stl_util_unittest.cc",
1353     "strings/nullable_string16_unittest.cc",
1354     "strings/pattern_unittest.cc",
1355     "strings/safe_sprintf_unittest.cc",
1356     "strings/string16_unittest.cc",
1357     "strings/string_number_conversions_unittest.cc",
1358     "strings/string_piece_unittest.cc",
1359     "strings/string_split_unittest.cc",
1360     "strings/string_tokenizer_unittest.cc",
1361     "strings/string_util_unittest.cc",
1362     "strings/stringize_macros_unittest.cc",
1363     "strings/stringprintf_unittest.cc",
1364     "strings/sys_string_conversions_mac_unittest.mm",
1365     "strings/sys_string_conversions_unittest.cc",
1366     "strings/utf_offset_string_conversions_unittest.cc",
1367     "strings/utf_string_conversions_unittest.cc",
1368     "supports_user_data_unittest.cc",
1369     "sync_socket_unittest.cc",
1370     "synchronization/cancellation_flag_unittest.cc",
1371     "synchronization/condition_variable_unittest.cc",
1372     "synchronization/lock_unittest.cc",
1373     "synchronization/waitable_event_unittest.cc",
1374     "synchronization/waitable_event_watcher_unittest.cc",
1375     "sys_info_unittest.cc",
1376     "system_monitor/system_monitor_unittest.cc",
1377     "task/cancelable_task_tracker_unittest.cc",
1378     "task_runner_util_unittest.cc",
1379     "template_util_unittest.cc",
1380     "test/histogram_tester_unittest.cc",
1381     "test/test_reg_util_win_unittest.cc",
1382     "test/trace_event_analyzer_unittest.cc",
1383     "test/user_action_tester_unittest.cc",
1384     "threading/non_thread_safe_unittest.cc",
1385     "threading/platform_thread_unittest.cc",
1386     "threading/sequenced_worker_pool_unittest.cc",
1387     "threading/simple_thread_unittest.cc",
1388     "threading/thread_checker_unittest.cc",
1389     "threading/thread_collision_warner_unittest.cc",
1390     "threading/thread_id_name_manager_unittest.cc",
1391     "threading/thread_local_storage_unittest.cc",
1392     "threading/thread_local_unittest.cc",
1393     "threading/thread_unittest.cc",
1394     "threading/watchdog_unittest.cc",
1395     "threading/worker_pool_posix_unittest.cc",
1396     "threading/worker_pool_unittest.cc",
1397     "time/pr_time_unittest.cc",
1398     "time/time_unittest.cc",
1399     "time/time_win_unittest.cc",
1400     "timer/hi_res_timer_manager_unittest.cc",
1401     "timer/mock_timer_unittest.cc",
1402     "timer/timer_unittest.cc",
1403     "tools_sanity_unittest.cc",
1404     "tracked_objects_unittest.cc",
1405     "tuple_unittest.cc",
1406     "values_unittest.cc",
1407     "version_unittest.cc",
1408     "vlog_unittest.cc",
1409     "win/dllmain.cc",
1410     "win/enum_variant_unittest.cc",
1411     "win/event_trace_consumer_unittest.cc",
1412     "win/event_trace_controller_unittest.cc",
1413     "win/event_trace_provider_unittest.cc",
1414     "win/i18n_unittest.cc",
1415     "win/iunknown_impl_unittest.cc",
1416     "win/message_window_unittest.cc",
1417     "win/object_watcher_unittest.cc",
1418     "win/pe_image_unittest.cc",
1419     "win/registry_unittest.cc",
1420     "win/scoped_bstr_unittest.cc",
1421     "win/scoped_comptr_unittest.cc",
1422     "win/scoped_process_information_unittest.cc",
1423     "win/scoped_variant_unittest.cc",
1424     "win/shortcut_unittest.cc",
1425     "win/startup_information_unittest.cc",
1426     "win/win_util_unittest.cc",
1427     "win/wrapped_window_proc_unittest.cc",
1428   ]
1430   deps = [
1431     ":base",
1432     ":i18n",
1433     ":message_loop_tests",
1434     ":prefs",
1435     ":prefs_test_support",
1436     "//base/allocator",
1437     "//base/test:run_all_unittests",
1438     "//base/test:test_support",
1439     "//base/third_party/dynamic_annotations",
1440     "//base/trace_event:trace_event_unittests",
1441     "//testing/gmock",
1442     "//testing/gtest",
1443     "//third_party/icu",
1444   ]
1446   data = [
1447     "test/data/",
1448   ]
1450   # Allow more direct string conversions on platforms with native utf8
1451   # strings
1452   if (is_mac || is_ios || is_chromeos) {
1453     defines = [ "SYSTEM_NATIVE_UTF8" ]
1454   }
1456   if (is_android) {
1457     apk_deps = [
1458       ":base_java",
1459       ":base_java_unittest_support",
1460     ]
1462     # TODO(brettw) I think this should not be here, we should not be using
1463     # isolate files.
1464     isolate_file = "base_unittests.isolate"
1465   }
1467   if (is_ios) {
1468     sources -= [
1469       "process/memory_unittest.cc",
1470       "process/process_unittest.cc",
1471       "process/process_util_unittest.cc",
1472     ]
1474     # Pull in specific Mac files for iOS (which have been filtered out by file
1475     # name rules).
1476     set_sources_assignment_filter([])
1477     sources += [
1478       "mac/bind_objc_block_unittest.mm",
1479       "mac/foundation_util_unittest.mm",
1480       "mac/objc_property_releaser_unittest.mm",
1481       "mac/scoped_nsobject_unittest.mm",
1482       "sys_string_conversions_mac_unittest.mm",
1483     ]
1484     set_sources_assignment_filter(sources_assignment_filter)
1486     # TODO(GYP): dep on copy_test_data_ios action.
1487   }
1489   if (is_linux) {
1490     sources -= [ "file_version_info_unittest.cc" ]
1491     sources += [ "nix/xdg_util_unittest.cc" ]
1492     deps += [ "//base/test:malloc_wrapper" ]
1494     if (use_glib) {
1495       configs += [ "//build/config/linux:glib" ]
1496     }
1497   }
1499   if (!is_linux || use_ozone) {
1500     sources -= [ "message_loop/message_pump_glib_unittest.cc" ]
1501   }
1503   if (is_posix || is_ios) {
1504     sources += [ "message_loop/message_pump_libevent_unittest.cc" ]
1505     deps += [ "//third_party/libevent" ]
1506   }
1508   if (is_android) {
1509     deps += [ "//testing/android/native_test:native_test_native_code" ]
1510     set_sources_assignment_filter([])
1511     sources += [ "debug/proc_maps_linux_unittest.cc" ]
1512     set_sources_assignment_filter(sources_assignment_filter)
1513   }
1515   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1516   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
1518   # Symbols for crashes when running tests on swarming.
1519   if (symbol_level > 0) {
1520     if (is_win) {
1521       data += [ "$root_out_dir/base_unittests.exe.pdb" ]
1522     } else if (is_mac) {
1523       data += [ "$root_out_dir/base_unittests.dSYM/" ]
1524     }
1525   }
1528 if (is_android) {
1529   # GYP: //base.gyp:base_jni_headers
1530   generate_jni("base_jni_headers") {
1531     sources = [
1532       "android/java/src/org/chromium/base/AnimationFrameTimeHistogram.java",
1533       "android/java/src/org/chromium/base/ApkAssets.java",
1534       "android/java/src/org/chromium/base/ApplicationStatus.java",
1535       "android/java/src/org/chromium/base/BuildInfo.java",
1536       "android/java/src/org/chromium/base/CommandLine.java",
1537       "android/java/src/org/chromium/base/ContentUriUtils.java",
1538       "android/java/src/org/chromium/base/CpuFeatures.java",
1539       "android/java/src/org/chromium/base/EventLog.java",
1540       "android/java/src/org/chromium/base/FieldTrialList.java",
1541       "android/java/src/org/chromium/base/ImportantFileWriterAndroid.java",
1542       "android/java/src/org/chromium/base/JNIUtils.java",
1543       "android/java/src/org/chromium/base/JavaHandlerThread.java",
1544       "android/java/src/org/chromium/base/LocaleUtils.java",
1545       "android/java/src/org/chromium/base/MemoryPressureListener.java",
1546       "android/java/src/org/chromium/base/PathService.java",
1547       "android/java/src/org/chromium/base/PathUtils.java",
1548       "android/java/src/org/chromium/base/PowerMonitor.java",
1549       "android/java/src/org/chromium/base/SysUtils.java",
1550       "android/java/src/org/chromium/base/SystemMessageHandler.java",
1551       "android/java/src/org/chromium/base/ThreadUtils.java",
1552       "android/java/src/org/chromium/base/TraceEvent.java",
1553       "android/java/src/org/chromium/base/library_loader/LibraryLoader.java",
1554       "android/java/src/org/chromium/base/metrics/RecordHistogram.java",
1555       "android/java/src/org/chromium/base/metrics/RecordUserAction.java",
1556     ]
1558     deps = [
1559       ":android_runtime_jni_headers",
1560     ]
1562     jni_package = "base"
1563   }
1565   # GYP: //base.gyp:android_runtime_jni_headers
1566   generate_jar_jni("android_runtime_jni_headers") {
1567     jni_package = "base"
1568     classes = [ "java/lang/Runtime.class" ]
1569   }
1571   # GYP: //base.gyp:base_java
1572   android_library("base_java") {
1573     srcjar_deps = [
1574       ":base_android_java_enums_srcjar",
1575       ":base_native_libraries_gen",
1576     ]
1578     deps = [
1579       "//third_party/jsr-305:jsr_305_javalib",
1580     ]
1582     DEPRECATED_java_in_dir = "android/java/src"
1584     # A new version of NativeLibraries.java (with the actual correct values)
1585     # will be created when creating an apk.
1586     jar_excluded_patterns = [
1587       "*/NativeLibraries.class",
1588       "*/NativeLibraries##*.class",
1589     ]
1590   }
1592   # GYP: //base.gyp:base_javatests
1593   android_library("base_javatests") {
1594     deps = [
1595       ":base_java",
1596       ":base_java_test_support",
1597     ]
1598     DEPRECATED_java_in_dir = "android/javatests/src"
1599   }
1601   # GYP: //base.gyp:base_java_test_support
1602   android_library("base_java_test_support") {
1603     deps = [
1604       ":base_java",
1605       "//testing/android/reporter:reporter_java",
1606     ]
1607     DEPRECATED_java_in_dir = "test/android/javatests/src"
1608   }
1610   # GYP: //base.gyp:base_junit_tests
1611   junit_binary("base_junit_tests") {
1612     java_files = [ "android/junit/src/org/chromium/base/LogTest.java" ]
1613     deps = [
1614       ":base_java",
1615       ":base_java_test_support",
1616     ]
1617   }
1619   # GYP: //base.gyp:base_java_application_state
1620   # GYP: //base.gyp:base_java_library_load_from_apk_status_codes
1621   # GYP: //base.gyp:base_java_library_process_type
1622   # GYP: //base.gyp:base_java_memory_pressure_level
1623   java_cpp_enum("base_android_java_enums_srcjar") {
1624     sources = [
1625       "android/application_status_listener.h",
1626       "android/library_loader/library_load_from_apk_status_codes.h",
1627       "android/library_loader/library_loader_hooks.h",
1628       "memory/memory_pressure_listener.h",
1629     ]
1630     outputs = [
1631       "org/chromium/base/ApplicationState.java",
1632       "org/chromium/base/library_loader/LibraryLoadFromApkStatusCodes.java",
1633       "org/chromium/base/library_loader/LibraryProcessType.java",
1634       "org/chromium/base/MemoryPressureLevel.java",
1635     ]
1636   }
1638   # GYP: //base/base.gyp:base_native_libraries_gen
1639   java_cpp_template("base_native_libraries_gen") {
1640     sources = [
1641       "android/java/templates/NativeLibraries.template",
1642     ]
1643     package_name = "org/chromium/base/library_loader"
1644   }
1646   # GYP: //base.gyp:base_java_unittest_support
1647   android_library("base_java_unittest_support") {
1648     deps = [
1649       ":base_java",
1650     ]
1651     java_files =
1652         [ "test/android/java/src/org/chromium/base/ContentUriTestUtils.java" ]
1653   }