| # 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. |
| |
| import("//build/config/jumbo.gni") |
| import("//testing/test.gni") |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| } |
| |
| static_library("demographic_metrics_provider") { |
| sources = [ |
| "demographic_metrics_provider.cc", |
| "demographic_metrics_provider.h", |
| ] |
| |
| public_deps = [ "//third_party/metrics_proto" ] |
| |
| deps = [ |
| ":metrics", |
| "//base", |
| "//components/sync/base", |
| "//components/sync/driver", |
| ] |
| } |
| |
| jumbo_static_library("metrics") { |
| sources = [ |
| "android_metrics_provider.cc", |
| "android_metrics_provider.h", |
| "call_stack_profile_metrics_provider.cc", |
| "call_stack_profile_metrics_provider.h", |
| "clean_exit_beacon.cc", |
| "clean_exit_beacon.h", |
| "client_info.cc", |
| "client_info.h", |
| "cloned_install_detector.cc", |
| "cloned_install_detector.h", |
| "cpu_metrics_provider.cc", |
| "cpu_metrics_provider.h", |
| "daily_event.cc", |
| "daily_event.h", |
| "data_use_tracker.cc", |
| "data_use_tracker.h", |
| "delegating_provider.cc", |
| "delegating_provider.h", |
| "drive_metrics_provider.cc", |
| "drive_metrics_provider.h", |
| "drive_metrics_provider_android.cc", |
| "drive_metrics_provider_ios.mm", |
| "drive_metrics_provider_linux.cc", |
| "drive_metrics_provider_mac.mm", |
| "drive_metrics_provider_win.cc", |
| "enabled_state_provider.cc", |
| "enabled_state_provider.h", |
| "entropy_state.cc", |
| "entropy_state.h", |
| "entropy_state_provider.cc", |
| "entropy_state_provider.h", |
| "environment_recorder.cc", |
| "environment_recorder.h", |
| "expired_histogram_util.cc", |
| "expired_histogram_util.h", |
| "expired_histograms_checker.cc", |
| "expired_histograms_checker.h", |
| "field_trials_provider.cc", |
| "field_trials_provider.h", |
| "file_metrics_provider.cc", |
| "file_metrics_provider.h", |
| "histogram_encoder.cc", |
| "histogram_encoder.h", |
| "log_decoder.cc", |
| "log_decoder.h", |
| "log_store.h", |
| "machine_id_provider.h", |
| "machine_id_provider_stub.cc", |
| "machine_id_provider_win.cc", |
| "metrics_log.cc", |
| "metrics_log.h", |
| "metrics_log_manager.cc", |
| "metrics_log_manager.h", |
| "metrics_log_store.cc", |
| "metrics_log_store.h", |
| "metrics_log_uploader.h", |
| "metrics_pref_names.cc", |
| "metrics_pref_names.h", |
| "metrics_provider.cc", |
| "metrics_provider.h", |
| "metrics_reporting_default_state.cc", |
| "metrics_reporting_default_state.h", |
| "metrics_reporting_service.cc", |
| "metrics_reporting_service.h", |
| "metrics_rotation_scheduler.cc", |
| "metrics_rotation_scheduler.h", |
| "metrics_scheduler.cc", |
| "metrics_scheduler.h", |
| "metrics_service.cc", |
| "metrics_service.h", |
| "metrics_service_accessor.cc", |
| "metrics_service_accessor.h", |
| "metrics_service_client.cc", |
| "metrics_service_client.h", |
| "metrics_state_manager.cc", |
| "metrics_state_manager.h", |
| "metrics_switches.cc", |
| "metrics_switches.h", |
| "metrics_upload_scheduler.cc", |
| "metrics_upload_scheduler.h", |
| "persistent_histograms.cc", |
| "persistent_histograms.h", |
| "persistent_system_profile.cc", |
| "persistent_system_profile.h", |
| "reporting_service.cc", |
| "reporting_service.h", |
| "stability_metrics_helper.cc", |
| "stability_metrics_helper.h", |
| "stability_metrics_provider.cc", |
| "stability_metrics_provider.h", |
| "system_memory_stats_recorder.h", |
| "system_memory_stats_recorder_linux.cc", |
| "system_session_analyzer_win.cc", |
| "system_session_analyzer_win.h", |
| "ukm_demographic_metrics_provider.h", |
| "unsent_log_store.cc", |
| "unsent_log_store.h", |
| "unsent_log_store_metrics.h", |
| "unsent_log_store_metrics_impl.cc", |
| "unsent_log_store_metrics_impl.h", |
| "url_constants.cc", |
| "url_constants.h", |
| "version_utils.cc", |
| "version_utils.h", |
| ] |
| |
| public_deps = [ |
| "//third_party/metrics_proto", |
| "//third_party/zlib/google:compression_utils", |
| ] |
| |
| deps = [ |
| "//base", |
| "//base:base_static", |
| "//build:branding_buildflags", |
| "//components/prefs", |
| "//components/variations", |
| "//components/version_info:version_info", |
| "//crypto", |
| "//extensions/buildflags", |
| "//url", |
| ] |
| |
| if (is_chromeos) { |
| deps += [ ":serialization" ] |
| } |
| |
| if (is_mac) { |
| libs = [ |
| # The below are all needed for drive_metrics_provider_mac.mm. |
| "CoreFoundation.framework", |
| "DiskArbitration.framework", |
| "Foundation.framework", |
| "IOKit.framework", |
| ] |
| } |
| |
| if (is_win) { |
| sources -= [ "machine_id_provider_stub.cc" ] |
| deps += [ "//components/browser_watcher:stability_client" ] |
| libs = [ "wevtapi.lib" ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ "drive_metrics_provider_fuchsia.cc" ] |
| } |
| } |
| |
| if (is_android) { |
| java_cpp_strings("java_switches_srcjar") { |
| # External code should depend on ":metrics_java" instead. |
| visibility = [ ":*" ] |
| sources = [ "//components/metrics/metrics_switches.cc" ] |
| template = |
| "//components/metrics/android/java_templates/MetricsSwitches.java.tmpl" |
| } |
| |
| android_library("metrics_java") { |
| # Right now, this only includes the Java switches. But if we need more Java |
| # files, they should be added here as necessary. |
| srcjar_deps = [ ":java_switches_srcjar" ] |
| } |
| } |
| |
| # The component metrics provider is a separate target because it depends upon |
| # (the large) component_updater code, and is not needed for some entities that |
| # depend on :metrics. |
| static_library("component_metrics") { |
| sources = [ |
| "component_metrics_provider.cc", |
| "component_metrics_provider.h", |
| ] |
| |
| public_deps = [ "//third_party/metrics_proto" ] |
| |
| deps = [ |
| ":metrics", |
| "//base", |
| "//components/component_updater", |
| ] |
| } |
| |
| if (!is_ios) { |
| static_library("gpu") { |
| sources = [ |
| "gpu/gpu_metrics_provider.cc", |
| "gpu/gpu_metrics_provider.h", |
| ] |
| |
| public_deps = [ ":metrics" ] |
| deps = [ |
| "//base", |
| "//content/public/browser", |
| "//gpu/config", |
| ] |
| } |
| } |
| |
| jumbo_static_library("net") { |
| sources = [ |
| "net/cellular_logic_helper.cc", |
| "net/cellular_logic_helper.h", |
| "net/net_metrics_log_uploader.cc", |
| "net/net_metrics_log_uploader.h", |
| "net/network_metrics_provider.cc", |
| "net/network_metrics_provider.h", |
| "net/wifi_access_point_info_provider.cc", |
| "net/wifi_access_point_info_provider.h", |
| ] |
| |
| public_deps = [ ":metrics" ] |
| allow_circular_includes_from = [ ":metrics" ] |
| |
| deps = [ |
| "//base", |
| "//components/encrypted_messages:encrypted_message_proto", |
| "//components/encrypted_messages:encrypted_messages", |
| "//components/variations", |
| "//net", |
| "//services/network/public/cpp:cpp", |
| "//third_party/metrics_proto", |
| "//third_party/zlib/google:compression_utils", |
| "//url", |
| ] |
| |
| if (is_chromeos) { |
| sources += [ |
| "net/wifi_access_point_info_provider_chromeos.cc", |
| "net/wifi_access_point_info_provider_chromeos.h", |
| ] |
| deps += [ "//chromeos/network" ] |
| } |
| } |
| |
| static_library("ui") { |
| sources = [ |
| "ui/screen_info_metrics_provider.cc", |
| "ui/screen_info_metrics_provider.h", |
| ] |
| |
| public_deps = [ ":metrics" ] |
| deps = [ |
| "//base", |
| "//ui/display", |
| "//ui/gfx", |
| "//ui/gfx/geometry", |
| ] |
| } |
| |
| static_library("single_sample_metrics") { |
| sources = [ |
| "single_sample_metrics.cc", |
| "single_sample_metrics.h", |
| "single_sample_metrics_factory_impl.cc", |
| "single_sample_metrics_factory_impl.h", |
| ] |
| |
| deps = [ |
| "//mojo/public/cpp/bindings", |
| "//services/service_manager/public/cpp", |
| "//services/service_manager/public/mojom", |
| ] |
| |
| public_deps = [ |
| "//components/metrics/public/mojom:single_sample_metrics_mojo_bindings", |
| ] |
| } |
| |
| source_set("call_stack_profile_params") { |
| public = [ |
| "call_stack_profile_encoding.h", |
| "call_stack_profile_params.h", |
| ] |
| sources = [ "call_stack_profile_encoding.cc" ] |
| |
| deps = [ |
| "//base:base", |
| "//third_party/metrics_proto", |
| ] |
| } |
| |
| # Dependency for child processes that use the CallStackProfileBuilder. |
| source_set("child_call_stack_profile_builder") { |
| public = [ |
| "call_stack_profile_builder.h", |
| "call_stack_profile_metadata.h", |
| "child_call_stack_profile_collector.h", |
| ] |
| sources = [ |
| "call_stack_profile_builder.cc", |
| "call_stack_profile_metadata.cc", |
| "child_call_stack_profile_collector.cc", |
| ] |
| public_deps = [ ":call_stack_profile_params" ] |
| deps = [ |
| "//base", |
| "//components/metrics/public/mojom:call_stack_mojo_bindings", |
| "//third_party/metrics_proto", |
| ] |
| |
| # This target must not depend on :metrics because that code is intended solely |
| # for use in the browser process. |
| assert_no_deps = [ ":metrics" ] |
| } |
| |
| # Dependency for browser process use of the CallStackProfileBuilder. |
| source_set("call_stack_profile_builder") { |
| deps = [ ":metrics" ] |
| public_deps = [ ":child_call_stack_profile_builder" ] |
| } |
| |
| # The browser process mojo service for collecting profiles from child |
| # processes. |
| source_set("call_stack_profile_collector") { |
| sources = [ |
| "call_stack_profile_collector.cc", |
| "call_stack_profile_collector.h", |
| ] |
| deps = [ |
| ":call_stack_profile_params", |
| ":metrics", |
| "//components/metrics/public/mojom:call_stack_mojo_bindings", |
| ] |
| } |
| |
| jumbo_static_library("test_support") { |
| testonly = true |
| sources = [ |
| "test_enabled_state_provider.cc", |
| "test_enabled_state_provider.h", |
| "test_metrics_log_uploader.cc", |
| "test_metrics_log_uploader.h", |
| "test_metrics_provider.cc", |
| "test_metrics_provider.h", |
| "test_metrics_service_client.cc", |
| "test_metrics_service_client.h", |
| ] |
| |
| public_deps = [ ":metrics" ] |
| deps = [ "//base" ] |
| } |
| |
| if (is_linux) { |
| static_library("serialization") { |
| sources = [ |
| "serialization/metric_sample.cc", |
| "serialization/metric_sample.h", |
| "serialization/serialization_utils.cc", |
| "serialization/serialization_utils.h", |
| ] |
| deps = [ "//base" ] |
| } |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "android_metrics_provider_unittest.cc", |
| "call_stack_profile_builder_unittest.cc", |
| "call_stack_profile_metadata_unittest.cc", |
| "call_stack_profile_metrics_provider_unittest.cc", |
| "child_call_stack_profile_collector_unittest.cc", |
| "cloned_install_detector_unittest.cc", |
| "component_metrics_provider_unittest.cc", |
| "daily_event_unittest.cc", |
| "data_use_tracker_unittest.cc", |
| "demographic_metrics_provider_unittest.cc", |
| "drive_metrics_provider_unittest.cc", |
| "entropy_state_provider_unittest.cc", |
| "entropy_state_unittest.cc", |
| "environment_recorder_unittest.cc", |
| "expired_histograms_checker_unittest.cc", |
| "field_trials_provider_unittest.cc", |
| "file_metrics_provider_unittest.cc", |
| "histogram_encoder_unittest.cc", |
| "machine_id_provider_win_unittest.cc", |
| "metrics_log_manager_unittest.cc", |
| "metrics_log_store_unittest.cc", |
| "metrics_log_unittest.cc", |
| "metrics_service_client_unittest.cc", |
| "metrics_service_unittest.cc", |
| "metrics_state_manager_unittest.cc", |
| "net/net_metrics_log_uploader_unittest.cc", |
| "net/network_metrics_provider_unittest.cc", |
| "persistent_system_profile_unittest.cc", |
| "reporting_service_unittest.cc", |
| "single_sample_metrics_factory_impl_unittest.cc", |
| "stability_metrics_helper_unittest.cc", |
| "stability_metrics_provider_unittest.cc", |
| "system_session_analyzer_win_unittest.cc", |
| "ui/screen_info_metrics_provider_unittest.cc", |
| "unsent_log_store_unittest.cc", |
| ] |
| |
| deps = [ |
| ":call_stack_profile_builder", |
| ":component_metrics", |
| ":demographic_metrics_provider", |
| ":metrics", |
| ":net", |
| ":single_sample_metrics", |
| ":test_support", |
| ":ui", |
| "//base/test:test_support", |
| "//components/component_updater:test_support", |
| "//components/encrypted_messages:encrypted_message_proto", |
| "//components/prefs:test_support", |
| "//components/sync/base", |
| "//components/sync/driver:test_support", |
| "//components/variations", |
| "//extensions/buildflags", |
| "//mojo/public/cpp/bindings", |
| "//net:test_support", |
| "//services/network:test_support", |
| "//services/network/public/cpp:cpp", |
| "//services/service_manager/public/cpp", |
| "//testing/gtest", |
| "//third_party/zlib/google:compression_utils", |
| "//ui/gfx/geometry", |
| ] |
| |
| if (is_linux) { |
| sources += [ "serialization/serialization_utils_unittest.cc" ] |
| deps += [ ":serialization" ] |
| } |
| |
| if (is_chromeos) { |
| deps += [ |
| "//chromeos/dbus:test_support", |
| "//chromeos/network:test_support", |
| ] |
| } |
| |
| # iOS is not supported by the profiler and the ios-simulator bot chokes on |
| # these tests. |
| if (is_ios) { |
| sources -= [ "child_call_stack_profile_collector_unittest.cc" ] |
| } |
| |
| if (is_ios) { |
| deps += [ "//ios/web/public/test" ] |
| } |
| |
| if (!is_ios) { |
| deps += [ "//content/test:test_support" ] |
| } |
| } |
| |
| # Convenience testing target |
| test("metrics_unittests") { |
| sources = [ "//components/test/run_all_unittests.cc" ] |
| deps = [ |
| ":unit_tests", |
| "//components/test:test_support", |
| ] |
| } |