diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-16 19:33:08 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-16 19:33:08 +0000 |
commit | 2354994eae6a4099f5cc03cf18513b29d219e9e2 (patch) | |
tree | bfbd0b4d447dce447b487f157742f9f7dee2011b | |
parent | afb30e39c6791afed6cd12f085649400e4d80ae8 (diff) | |
download | chromium_src-2354994eae6a4099f5cc03cf18513b29d219e9e2.zip chromium_src-2354994eae6a4099f5cc03cf18513b29d219e9e2.tar.gz chromium_src-2354994eae6a4099f5cc03cf18513b29d219e9e2.tar.bz2 |
Hook up base unit tests and allocator to GN build.
Adds a meta-target "//base/allocator" that forwards to tcmallor or nothing depending on the build configuration.
Write tcmalloc target definition.
Write base unit tests prefs, and some support targets from base.gypi.
Fix a bunch of added files in the base target that were exposed by linking the unit tests.
Removes toolkit_uses_gtk which was removed from the GYP build.
BUG=
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/288203003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271079 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/BUILD.gn | 426 | ||||
-rw-r--r-- | base/allocator/BUILD.gn | 200 | ||||
-rw-r--r-- | base/test/BUILD.gn | 22 | ||||
-rw-r--r-- | build/config/BUILD.gn | 4 | ||||
-rw-r--r-- | build/config/allocator.gni | 14 | ||||
-rw-r--r-- | build/config/ui.gni | 3 | ||||
-rw-r--r-- | tools/gn/secondary/chrome/BUILD.gn | 5 |
7 files changed, 630 insertions, 44 deletions
diff --git a/base/BUILD.gn b/base/BUILD.gn index c09946b..3bbd897 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/ui.gni") import("//build/config/android/rules.gni") +import("//build/config/ui.gni") component("base") { sources = [ @@ -59,6 +59,9 @@ component("base") { "android/thread_utils.h", "android/trace_event_binding.cc", "android/trace_event_binding.h", + "async_socket_io_handler.h", + "async_socket_io_handler_posix.cc", + "async_socket_io_handler_win.cc", "at_exit.cc", "at_exit.h", "atomic_ref_count.h", @@ -70,6 +73,8 @@ component("base") { "atomicops_internals_x86_gcc.cc", "atomicops_internals_x86_gcc.h", "atomicops_internals_x86_msvc.h", + "barrier_closure.cc", + "barrier_closure.h", "base_export.h", "base_paths.cc", "base_paths.h", @@ -96,6 +101,7 @@ component("base") { "build_time.cc", "build_time.h", "callback.h", + "callback_helpers.cc", "callback_helpers.h", "callback_internal.cc", "callback_internal.h", @@ -143,6 +149,8 @@ component("base") { "debug/trace_event_memory.h", "debug/trace_event_synthetic_delay.cc", "debug/trace_event_synthetic_delay.h", + "debug/trace_event_system_stats_monitor.cc", + "debug/trace_event_system_stats_monitor.h", "debug/trace_event_win.cc", "deferred_sequenced_task_runner.cc", "deferred_sequenced_task_runner.h", @@ -178,8 +186,9 @@ component("base") { "files/file_path_watcher.h", "files/file_path_watcher_kqueue.cc", "files/file_path_watcher_linux.cc", - "files/file_path_watcher_stub.cc", "files/file_path_watcher_win.cc", + "files/file_proxy.cc", + "files/file_proxy.h", "files/file_util_proxy.cc", "files/file_util_proxy.h", "files/important_file_writer.cc", @@ -327,8 +336,6 @@ component("base") { "message_loop/message_pump_default.h", "message_loop/message_pump_glib.cc", "message_loop/message_pump_glib.h", - "message_loop/message_pump_gtk.cc", - "message_loop/message_pump_gtk.h", "message_loop/message_pump_io_ios.cc", "message_loop/message_pump_io_ios.h", "message_loop/message_pump_libevent.cc", @@ -350,6 +357,8 @@ component("base") { "metrics/histogram.h", "metrics/histogram_base.cc", "metrics/histogram_base.h", + "metrics/histogram_delta_serialization.cc", + "metrics/histogram_delta_serialization.", "metrics/histogram_flattener.h", "metrics/histogram_samples.cc", "metrics/histogram_samples.h", @@ -451,6 +460,7 @@ component("base") { "process/process_iterator_openbsd.cc", "process/process_iterator_win.cc", "process/process_linux.cc", + "process/process_metrics.cc", "process/process_metrics.h", "process/process_metrics_freebsd.cc", "process/process_metrics_ios.cc", @@ -494,6 +504,8 @@ component("base") { "strings/latin1_string_conversions.h", "strings/nullable_string16.cc", "strings/nullable_string16.h", + "strings/safe_sprintf.cc", + "strings/safe_sprintf.h", "strings/string16.cc", "strings/string16.h", "strings/string_number_conversions.cc", @@ -557,6 +569,8 @@ component("base") { "sys_info_openbsd.cc", "sys_info_posix.cc", "sys_info_win.cc", + "task/cancelable_task_tracker.cc", + "task/cancelable_task_tracker.h", "task_runner.cc", "task_runner.h", "task_runner_util.h", @@ -588,6 +602,7 @@ component("base") { "threading/thread_id_name_manager.cc", "threading/thread_id_name_manager.h", "threading/thread_local.h", + "threading/thread_local_android.cc", "threading/thread_local_posix.cc", "threading/thread_local_storage.cc", "threading/thread_local_storage.h", @@ -621,6 +636,8 @@ component("base") { "timer/hi_res_timer_manager.h", "timer/hi_res_timer_manager_posix.cc", "timer/hi_res_timer_manager_win.cc", + "timer/mock_timer.cc", + "timer/mock_timer.h", "timer/timer.cc", "timer/timer.h", "tracked_objects.cc", @@ -687,8 +704,9 @@ component("base") { "win/wrapped_window_proc.h", ] - # TODO(brettw) I don't understand the conditions this file is used. - sources -= [ "files/file_path_watcher_stub.cc" ] + if (is_nacl) { + sources += [ "files/file_path_watcher_stub.cc" ] + } sources -= [ "process/process_handle_freebsd.cc", @@ -822,9 +840,6 @@ component("base") { linux_configs = [ "//build/config/linux:glib", ] - if (toolkit_uses_gtk) { - linux_configs += [ "//build/config/linux:gtk" ] - } configs += linux_configs all_dependent_configs = linux_configs @@ -852,12 +867,6 @@ component("base") { "message_loop/message_pump_glib.h", ] } - if (!toolkit_uses_gtk) { - sources -= [ - "message_loop/message_pump_gtk.cc", - "message_loop/message_pump_gtk.h", - ] - } } # This is the subset of files from base that should not be used with a dynamic @@ -918,23 +927,382 @@ component("i18n") { "//base/third_party/dynamic_annotations", "//third_party/icu", ] +} + +source_set("prefs") { + sources = [ + "prefs/base_prefs_export.h", + "prefs/default_pref_store.cc", + "prefs/default_pref_store.h", + "prefs/json_pref_store.cc", + "prefs/json_pref_store.h", + "prefs/overlay_user_pref_store.cc", + "prefs/overlay_user_pref_store.h", + "prefs/persistent_pref_store.h", + "prefs/pref_change_registrar.cc", + "prefs/pref_change_registrar.h", + "prefs/pref_filter.h", + "prefs/pref_member.cc", + "prefs/pref_member.h", + "prefs/pref_notifier.h", + "prefs/pref_notifier_impl.cc", + "prefs/pref_notifier_impl.h", + "prefs/pref_observer.h", + "prefs/pref_registry.cc", + "prefs/pref_registry.h", + "prefs/pref_registry_simple.cc", + "prefs/pref_registry_simple.h", + "prefs/pref_service.cc", + "prefs/pref_service.h", + "prefs/pref_service_factory.cc", + "prefs/pref_service_factory.h", + "prefs/pref_store.cc", + "prefs/pref_store.h", + "prefs/pref_value_map.cc", + "prefs/pref_value_map.h", + "prefs/pref_value_store.cc", + "prefs/pref_value_store.h", + "prefs/scoped_user_pref_update.cc", + "prefs/scoped_user_pref_update.h", + "prefs/value_map_pref_store.cc", + "prefs/value_map_pref_store.h", + "prefs/writeable_pref_store.h", + + ] + + defines = [ "BASE_PREFS_IMPLEMENTATION" ] + + deps = [ ":base" ] +} + +source_set("prefs_test_support") { + sources = [ + "prefs/mock_pref_change_callback.cc", + "prefs/pref_store_observer_mock.cc", + "prefs/pref_store_observer_mock.h", + "prefs/testing_pref_service.cc", + "prefs/testing_pref_service.h", + "prefs/testing_pref_store.cc", + "prefs/testing_pref_store.h", + ] + + deps = [ + ":base", + ":prefs", + "//testing/gmock", + ] +} + +source_set("message_loop_tests") { + sources = [ + "message_loop/message_loop_test.cc", + "message_loop/message_loop_test.h", + ] + + deps = [ + ":base", + "//testing/gtest", + ] +} + +test("base_unittests") { + sources = [ + "android/application_status_listener_unittest.cc", + "android/jni_android_unittest.cc", + "android/jni_array_unittest.cc", + "android/jni_string_unittest.cc", + "android/path_utils_unittest.cc", + "android/scoped_java_ref_unittest.cc", + "android/sys_utils_unittest.cc", + "async_socket_io_handler_unittest.cc", + "at_exit_unittest.cc", + "atomicops_unittest.cc", + "barrier_closure_unittest.cc", + "base64_unittest.cc", + "big_endian_unittest.cc", + "bind_unittest.cc", + "bind_unittest.nc", + "bits_unittest.cc", + "build_time_unittest.cc", + "callback_helpers_unittest.cc", + "callback_list_unittest.cc", + "callback_list_unittest.nc", + "callback_unittest.cc", + "callback_unittest.nc", + "cancelable_callback_unittest.cc", + "command_line_unittest.cc", + "containers/hash_tables_unittest.cc", + "containers/linked_list_unittest.cc", + "containers/mru_cache_unittest.cc", + "containers/small_map_unittest.cc", + "containers/stack_container_unittest.cc", + "cpu_unittest.cc", + "debug/crash_logging_unittest.cc", + "debug/leak_tracker_unittest.cc", + "debug/proc_maps_linux_unittest.cc", + "debug/stack_trace_unittest.cc", + "debug/trace_event_memory_unittest.cc", + "debug/trace_event_synthetic_delay_unittest.cc", + "debug/trace_event_system_stats_monitor_unittest.cc", + "debug/trace_event_unittest.cc", + "debug/trace_event_unittest.h", + "debug/trace_event_win_unittest.cc", + "deferred_sequenced_task_runner_unittest.cc", + "environment_unittest.cc", + "file_util_unittest.cc", + "file_version_info_unittest.cc", + "files/dir_reader_posix_unittest.cc", + "files/file_path_unittest.cc", + "files/file_proxy_unittest.cc", + "files/file_unittest.cc", + "files/file_util_proxy_unittest.cc", + "files/important_file_writer_unittest.cc", + "files/scoped_temp_dir_unittest.cc", + "gmock_unittest.cc", + "guid_unittest.cc", + "hash_unittest.cc", + "id_map_unittest.cc", + "i18n/break_iterator_unittest.cc", + "i18n/char_iterator_unittest.cc", + "i18n/case_conversion_unittest.cc", + "i18n/file_util_icu_unittest.cc", + "i18n/icu_string_conversions_unittest.cc", + "i18n/number_formatting_unittest.cc", + "i18n/rtl_unittest.cc", + "i18n/streaming_utf8_validator_unittest.cc", + "i18n/string_search_unittest.cc", + "i18n/time_formatting_unittest.cc", + "i18n/timezone_unittest.cc", + "ini_parser_unittest.cc", + "ios/device_util_unittest.mm", + "json/json_parser_unittest.cc", + "json/json_reader_unittest.cc", + "json/json_value_converter_unittest.cc", + "json/json_value_serializer_unittest.cc", + "json/json_writer_unittest.cc", + "json/string_escape_unittest.cc", + "lazy_instance_unittest.cc", + "logging_unittest.cc", + "mac/bind_objc_block_unittest.mm", + "mac/foundation_util_unittest.mm", + "mac/libdispatch_task_runner_unittest.cc", + "mac/mac_util_unittest.mm", + "mac/objc_property_releaser_unittest.mm", + "mac/scoped_nsobject_unittest.mm", + "mac/scoped_sending_event_unittest.mm", + "md5_unittest.cc", + "memory/aligned_memory_unittest.cc", + "memory/discardable_memory_manager_unittest.cc", + "memory/discardable_memory_unittest.cc", + "memory/linked_ptr_unittest.cc", + "memory/ref_counted_memory_unittest.cc", + "memory/ref_counted_unittest.cc", + "memory/scoped_ptr_unittest.cc", + "memory/scoped_ptr_unittest.nc", + "memory/scoped_vector_unittest.cc", + "memory/shared_memory_unittest.cc", + "memory/singleton_unittest.cc", + "memory/weak_ptr_unittest.cc", + "memory/weak_ptr_unittest.nc", + "message_loop/message_loop_proxy_impl_unittest.cc", + "message_loop/message_loop_proxy_unittest.cc", + "message_loop/message_loop_unittest.cc", + "message_loop/message_pump_glib_unittest.cc", + "message_loop/message_pump_io_ios_unittest.cc", + "message_loop/message_pump_libevent_unittest.cc", + "metrics/sample_map_unittest.cc", + "metrics/sample_vector_unittest.cc", + "metrics/bucket_ranges_unittest.cc", + "metrics/field_trial_unittest.cc", + "metrics/histogram_base_unittest.cc", + "metrics/histogram_delta_serialization_unittest.cc", + "metrics/histogram_snapshot_manager_unittest.cc", + "metrics/histogram_unittest.cc", + "metrics/sparse_histogram_unittest.cc", + "metrics/stats_table_unittest.cc", + "metrics/statistics_recorder_unittest.cc", + "observer_list_unittest.cc", + "os_compat_android_unittest.cc", + "path_service_unittest.cc", + "pickle_unittest.cc", + "platform_file_unittest.cc", + "posix/file_descriptor_shuffle_unittest.cc", + "posix/unix_domain_socket_linux_unittest.cc", + "power_monitor/power_monitor_unittest.cc", + "prefs/default_pref_store_unittest.cc", + "prefs/json_pref_store_unittest.cc", + "prefs/mock_pref_change_callback.h", + "prefs/overlay_user_pref_store_unittest.cc", + "prefs/pref_change_registrar_unittest.cc", + "prefs/pref_member_unittest.cc", + "prefs/pref_notifier_impl_unittest.cc", + "prefs/pref_service_unittest.cc", + "prefs/pref_value_map_unittest.cc", + "prefs/pref_value_store_unittest.cc", + "prefs/scoped_user_pref_update_unittest.cc", + "process/memory_unittest.cc", + "process/memory_unittest_mac.h", + "process/memory_unittest_mac.mm", + "process/process_metrics_unittest.cc", + "process/process_metrics_unittest_ios.cc", + "process/process_util_unittest.cc", + "process/process_util_unittest_ios.cc", + "profiler/tracked_time_unittest.cc", + "rand_util_unittest.cc", + "numerics/safe_numerics_unittest.cc", + "scoped_clear_errno_unittest.cc", + "scoped_generic_unittest.cc", + "scoped_native_library_unittest.cc", + "scoped_observer.h", + "security_unittest.cc", + "sequence_checker_unittest.cc", + "sha1_unittest.cc", + "stl_util_unittest.cc", + "strings/nullable_string16_unittest.cc", + "strings/safe_sprintf_unittest.cc", + "strings/string16_unittest.cc", + "strings/stringprintf_unittest.cc", + "strings/string_number_conversions_unittest.cc", + "strings/string_piece_unittest.cc", + "strings/string_split_unittest.cc", + "strings/string_tokenizer_unittest.cc", + "strings/string_util_unittest.cc", + "strings/stringize_macros_unittest.cc", + "strings/sys_string_conversions_mac_unittest.mm", + "strings/sys_string_conversions_unittest.cc", + "strings/utf_offset_string_conversions_unittest.cc", + "strings/utf_string_conversions_unittest.cc", + "sync_socket_unittest.cc", + "synchronization/cancellation_flag_unittest.cc", + "synchronization/condition_variable_unittest.cc", + "synchronization/lock_unittest.cc", + "synchronization/waitable_event_unittest.cc", + "synchronization/waitable_event_watcher_unittest.cc", + "sys_info_unittest.cc", + "system_monitor/system_monitor_unittest.cc", + "task/cancelable_task_tracker_unittest.cc", + "task_runner_util_unittest.cc", + "template_util_unittest.cc", + "test/expectations/expectation_unittest.cc", + "test/expectations/parser_unittest.cc", + "test/statistics_delta_reader_unittest.cc", + "test/test_reg_util_win_unittest.cc", + "test/trace_event_analyzer_unittest.cc", + "threading/non_thread_safe_unittest.cc", + "threading/platform_thread_unittest.cc", + "threading/sequenced_worker_pool_unittest.cc", + "threading/simple_thread_unittest.cc", + "threading/thread_checker_unittest.cc", + "threading/thread_collision_warner_unittest.cc", + "threading/thread_id_name_manager_unittest.cc", + "threading/thread_local_storage_unittest.cc", + "threading/thread_local_unittest.cc", + "threading/thread_unittest.cc", + "threading/watchdog_unittest.cc", + "threading/worker_pool_posix_unittest.cc", + "threading/worker_pool_unittest.cc", + "time/pr_time_unittest.cc", + "time/time_unittest.cc", + "time/time_win_unittest.cc", + "timer/hi_res_timer_manager_unittest.cc", + "timer/mock_timer_unittest.cc", + "timer/timer_unittest.cc", + "tools_sanity_unittest.cc", + "tracked_objects_unittest.cc", + "tuple_unittest.cc", + "values_unittest.cc", + "version_unittest.cc", + "vlog_unittest.cc", + "win/dllmain.cc", + "win/enum_variant_unittest.cc", + "win/event_trace_consumer_unittest.cc", + "win/event_trace_controller_unittest.cc", + "win/event_trace_provider_unittest.cc", + "win/i18n_unittest.cc", + "win/iunknown_impl_unittest.cc", + "win/message_window_unittest.cc", + "win/object_watcher_unittest.cc", + "win/pe_image_unittest.cc", + "win/registry_unittest.cc", + "win/scoped_bstr_unittest.cc", + "win/scoped_comptr_unittest.cc", + "win/scoped_process_information_unittest.cc", + "win/scoped_variant_unittest.cc", + "win/shortcut_unittest.cc", + "win/startup_information_unittest.cc", + "win/win_util_unittest.cc", + "win/wrapped_window_proc_unittest.cc", + ] + + deps = [ + ":base", + ":i18n", + ":message_loop_tests", + ":prefs", + ":prefs_test_support", + "//base/allocator", + "//base/test:run_all_unittests", + "//base/test:test_support", + "//base/third_party/dynamic_annotations", + "//testing/gmock", + "//testing/gtest", + "//third_party/icu", + ] - if (toolkit_uses_gtk) { - # i18n/rtl.cc uses gtk - configs += [ "//build/config/linux:gtk" ] + if (is_ios) { + sources -= [ + "message_loop/message_pump_libevent_unittest.cc", # libevent not used. + "metrics/stats_table_uinittest.cc", # Requires spawning a process. + "process/memory_unittest.cc", + "process/memory_unittest_mac.h", + "process/memory_unittest_mac.mm", + "process/process_util_unittest.cc", + ] + + # Pull in specific Mac files for iOS (which have been filtered out by file + # name rules). + set_sources_assignment_filter([]) + sources += [ + "mac/bind_objc_block_unittest.mm", + "mac/foundation_util_unittest.mm", + "mac/objc_property_releaser_unittest.mm", + "mac/scoped_nsobject_unittest.mm", + "sys_string_conversions_mac_unittest.mm", + ] + set_sources_assignment_filter(sources_assignment_filter) + + # TODO(GYP): dep on copy_test_data_ios action. } - #'conditions': [ - # ['OS == "win"', { - # # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - # 'msvs_disabled_warnings': [ - # 4267, - # ], - # }], - #], - #'variables': { - # 'optimize': 'max', - #}, + if (is_linux) { + sources -= [ "file_version_info_unittest.cc" ] + sources += [ "nix/xdg_util_unittest.cc" ] + defines = [ "USE_SYMBOLIZE" ] + configs += [ "//build/config/linux:glib" ] + } + + if (!is_linux || use_ozone) { + sources -= [ "message_loop/message_pump_glib_unittest.cc" ] + } + + if (is_win) { + sources -= [ + "file_descriptor_shuffle_unittest.cc", + "files/dir_reader_posix_unittest.cc", + "threading/worker_pool_posix_unittest.cc", + "message_loop/message_pump_libevent_unittest.cc", + ] + } + + if (!is_win || is_ios) { + deps += [ "//third_party/libevent" ] + } + + if (is_android) { + set_sources_assignment_filter([]) + sources += [ "debug/proc_maps_linux_unittest.cc" ] + set_sources_assignment_filter(sources_assignment_filter) + } } if (is_android) { diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn index 2646f2b..63ce93c 100644 --- a/base/allocator/BUILD.gn +++ b/base/allocator/BUILD.gn @@ -2,7 +2,205 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -static_library("allocator_extension_thunks") { +import("//build/config/allocator.gni") + +# Only executables and not libraries should depend on the allocator target; +# only the application (the final executable) knows what allocator makes sense. +# This "allocator" meta-target will forward to the default allocator according +# to the build settings. +group("allocator") { + if (use_allocator == "tcmalloc") { + deps = [ ":tcmalloc" ] + } +} + +if (!is_android) { + # tcmalloc currently won't compile on Android. + source_set("tcmalloc") { + tcmalloc_dir = "//third_party/tcmalloc/chromium" + + sources = [ + # Generated for our configuration from tcmalloc"s build + # and checked in. + "$tcmalloc_dir/src/config.h", + "$tcmalloc_dir/src/config_android.h", + "$tcmalloc_dir/src/config_linux.h", + "$tcmalloc_dir/src/config_win.h", + + # tcmalloc native and forked files. + "$tcmalloc_dir/src/base/abort.cc", + "$tcmalloc_dir/src/base/abort.h", + "$tcmalloc_dir/src/base/arm_instruction_set_select.h", + # We don't list dynamic_annotations.c since its copy is already + # present in the dynamic_annotations target. + "$tcmalloc_dir/src/base/elf_mem_image.cc", + "$tcmalloc_dir/src/base/linuxthreads.cc", + "$tcmalloc_dir/src/base/linuxthreads.h", + "$tcmalloc_dir/src/base/logging.cc", + "$tcmalloc_dir/src/base/logging.h", + "$tcmalloc_dir/src/base/low_level_alloc.cc", + "$tcmalloc_dir/src/base/low_level_alloc.h", + "$tcmalloc_dir/src/base/spinlock.cc", + "$tcmalloc_dir/src/base/spinlock.h", + "$tcmalloc_dir/src/base/spinlock_internal.cc", + "$tcmalloc_dir/src/base/spinlock_internal.h", + "$tcmalloc_dir/src/base/synchronization_profiling.h", + "$tcmalloc_dir/src/base/sysinfo.cc", + "$tcmalloc_dir/src/base/sysinfo.h", + "$tcmalloc_dir/src/base/thread_lister.c", + "$tcmalloc_dir/src/base/thread_lister.h", + "$tcmalloc_dir/src/base/vdso_support.cc", + "$tcmalloc_dir/src/base/vdso_support.h", + "$tcmalloc_dir/src/central_freelist.cc", + "$tcmalloc_dir/src/central_freelist.h", + "$tcmalloc_dir/src/common.cc", + "$tcmalloc_dir/src/common.h", + # #included by debugallocation_shim.cc + #"$tcmalloc_dir/src/debugallocation.cc", + "$tcmalloc_dir/src/deep-heap-profile.cc", + "$tcmalloc_dir/src/deep-heap-profile.h", + "$tcmalloc_dir/src/free_list.cc", + "$tcmalloc_dir/src/free_list.h", + "$tcmalloc_dir/src/heap-profile-table.cc", + "$tcmalloc_dir/src/heap-profile-table.h", + "$tcmalloc_dir/src/heap-profiler.cc", + "$tcmalloc_dir/src/internal_logging.cc", + "$tcmalloc_dir/src/internal_logging.h", + "$tcmalloc_dir/src/linked_list.h", + "$tcmalloc_dir/src/malloc_extension.cc", + "$tcmalloc_dir/src/malloc_hook-inl.h", + "$tcmalloc_dir/src/malloc_hook.cc", + "$tcmalloc_dir/src/maybe_threads.cc", + "$tcmalloc_dir/src/maybe_threads.h", + "$tcmalloc_dir/src/memory_region_map.cc", + "$tcmalloc_dir/src/memory_region_map.h", + "$tcmalloc_dir/src/page_heap.cc", + "$tcmalloc_dir/src/page_heap.h", + "$tcmalloc_dir/src/profile-handler.cc", + "$tcmalloc_dir/src/profile-handler.h", + "$tcmalloc_dir/src/profiledata.cc", + "$tcmalloc_dir/src/profiledata.h", + "$tcmalloc_dir/src/profiler.cc", + "$tcmalloc_dir/src/raw_printer.cc", + "$tcmalloc_dir/src/raw_printer.h", + "$tcmalloc_dir/src/sampler.cc", + "$tcmalloc_dir/src/sampler.h", + "$tcmalloc_dir/src/span.cc", + "$tcmalloc_dir/src/span.h", + "$tcmalloc_dir/src/stack_trace_table.cc", + "$tcmalloc_dir/src/stack_trace_table.h", + "$tcmalloc_dir/src/stacktrace.cc", + "$tcmalloc_dir/src/static_vars.cc", + "$tcmalloc_dir/src/static_vars.h", + "$tcmalloc_dir/src/symbolize.cc", + "$tcmalloc_dir/src/symbolize.h", + "$tcmalloc_dir/src/system-alloc.cc", + "$tcmalloc_dir/src/system-alloc.h", + # #included by debugallocation_shim.cc + #"$tcmalloc_dir/src/tcmalloc.cc", + "$tcmalloc_dir/src/thread_cache.cc", + "$tcmalloc_dir/src/thread_cache.h", + "$tcmalloc_dir/src/windows/port.cc", + "$tcmalloc_dir/src/windows/port.h", + + "allocator_shim.cc", + "allocator_shim.h", + "debugallocation_shim.cc", + + # These are both #included by allocator_shim for maximal linking. + #"generic_allocators.cc", + #"win_allocator.cc", + ] + + # Disable the heap checker in tcmalloc. + defines = [ "NO_HEAP_CHECK" ] + + include_dirs = [ + ".", + "$tcmalloc_dir/src/base", + "$tcmalloc_dir/src", + ] + + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + + if (is_win) { + sources -= [ + "$tcmalloc_dir/src/base/elf_mem_image.cc", + "$tcmalloc_dir/src/base/elf_mem_image.h", + "$tcmalloc_dir/src/base/linuxthreads.cc", + "$tcmalloc_dir/src/base/linuxthreads.h", + "$tcmalloc_dir/src/base/vdso_support.cc", + "$tcmalloc_dir/src/base/vdso_support.h", + "$tcmalloc_dir/src/maybe_threads.cc", + "$tcmalloc_dir/src/maybe_threads.h", + "$tcmalloc_dir/src/symbolize.h", + "$tcmalloc_dir/src/system-alloc.cc", + "$tcmalloc_dir/src/system-alloc.h", + + # included by allocator_shim.cc + "debugallocation_shim.cc", + + # cpuprofiler + "$tcmalloc_dir/src/base/thread_lister.c", + "$tcmalloc_dir/src/base/thread_lister.h", + "$tcmalloc_dir/src/profiledata.cc", + "$tcmalloc_dir/src/profiledata.h", + "$tcmalloc_dir/src/profile-handler.cc", + "$tcmalloc_dir/src/profile-handler.h", + "$tcmalloc_dir/src/profiler.cc", + ] + defines = [ "PERFTOOLS_DLL_DECL=" ] + } + if (is_linux || is_android) { + sources -= [ + "$tcmalloc_dir/src/system-alloc.h", + "$tcmalloc_dir/src/windows/port.cc", + "$tcmalloc_dir/src/windows/port.h", + + # TODO(willchan): Support allocator shim later on. + "allocator_shim.cc", + ] + + # We enable all warnings by default, but upstream disables a few. + # Keep "-Wno-*" flags in sync with upstream by comparing against: + # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am + cflags = [ + "-Wno-sign-compare", + "-Wno-unused-result", + ] + + configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] + + ldflags = [ + # Don't let linker rip this symbol out, otherwise the heap&cpu + # profilers will not initialize properly on startup. + "-Wl,-uIsHeapProfilerRunning,-uProfilerStart", + # Do the same for heap leak checker. + "-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi", + "-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl", + "-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv", + ] + } + + # Make sure the allocation library is optimized as much as possible when + # we"re in release mode. + if (!is_debug) { + configs -= [ "//build/config/compiler:optimize" ] + configs += [ "//build/config/compiler:optimize_max" ] + } + + deps = [ + "//base/third_party/dynamic_annotations", + ] + + if (is_win) { + ldflags = [ "/ignore:4006:4221" ] + } + } +} # !is_android + +source_set("allocator_extension_thunks") { visibility = "//base/*" sources = [ "allocator_extension_thunks.cc", diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn index 23ac142..6940bc4 100644 --- a/base/test/BUILD.gn +++ b/base/test/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/android/rules.gni") import("//build/config/ui.gni") source_set("test_support") { @@ -52,10 +53,13 @@ source_set("test_support") { "simple_test_clock.h", "simple_test_tick_clock.cc", "simple_test_tick_clock.h", + "statistics_delta_reader.cc", + "statistics_delta_reader.h", "task_runner_test_template.cc", "task_runner_test_template.h", "test_file_util.cc", "test_file_util.h", + "test_file_util_android.cc", "test_file_util_linux.cc", "test_file_util_mac.cc", "test_file_util_posix.cc", @@ -114,8 +118,9 @@ source_set("test_support") { set_sources_assignment_filter([]) sources += [ "test_file_util_mac.cc" ] } - if (toolkit_uses_gtk) { - configs += [ "//build/config/linux:gtk" ] + + if (is_android) { + deps += [ ":base_unittests_jni_headers" ] } } @@ -134,10 +139,6 @@ static_library("test_support_perf") { ] direct_dependent_configs = [ ":perf_test_config" ] - - if (toolkit_uses_gtk) { - configs += [ "//build/config/linux:gtk" ] - } } source_set("run_all_unittests") { @@ -148,3 +149,12 @@ source_set("run_all_unittests") { ":test_support", ] } + +if (is_android) { + generate_jni("base_unittests_jni_headers") { + sources = [ + "android/java/src/org/chromium/base/ContentUriTestUtils.java", + ] + jni_package = "base" + } +} diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index d83a221..48a33ed 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/allocator.gni") import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/ui.gni") @@ -120,6 +121,9 @@ config("feature_flags") { defines += [ "USE_XI2_MT=$use_xi2_mt" ] } } + if (use_allocator != "tcmalloc") { + defines += [ "NO_TCMALLOC" ] + } } # Debug/release ---------------------------------------------------------------- diff --git a/build/config/allocator.gni b/build/config/allocator.gni new file mode 100644 index 0000000..ef10c3d --- /dev/null +++ b/build/config/allocator.gni @@ -0,0 +1,14 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +if (is_android || cpu_arch == "mipsel") { + _default_allocator = "none" +} else { + _default_allocator = "tcmalloc" +} + +declare_args() { + # Memory allocator to use. Set to "none" to use default allocator. + use_allocator = _default_allocator +} diff --git a/build/config/ui.gni b/build/config/ui.gni index 6577331..360e860 100644 --- a/build/config/ui.gni +++ b/build/config/ui.gni @@ -44,9 +44,6 @@ if (is_linux) { use_pango = false } -# Indicates if the UI toolkit depends on GTK. -toolkit_uses_gtk = is_linux && !is_chromeos && !use_aura && !use_ozone - # Use GPU accelerated cross process image transport by default on linux builds # with the Aura window manager. ui_compositor_image_transport = use_aura && is_linux diff --git a/tools/gn/secondary/chrome/BUILD.gn b/tools/gn/secondary/chrome/BUILD.gn index 23ad588..96c9f55 100644 --- a/tools/gn/secondary/chrome/BUILD.gn +++ b/tools/gn/secondary/chrome/BUILD.gn @@ -65,11 +65,6 @@ executable("chrome") { static_library("browser") { if (is_linux) { - if (toolkit_uses_gtk) { - libs = [ "gconf-2" ] - } - } - if (is_linux) { configs += [ "//build/config/linux:x11", ] |