| # 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("//testing/test.gni") |
| |
| static_library("metrics") { |
| sources = [ |
| "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", |
| "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", |
| "environment_recorder.cc", |
| "environment_recorder.h", |
| "execution_phase.cc", |
| "execution_phase.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", |
| "persisted_logs.cc", |
| "persisted_logs.h", |
| "persisted_logs_metrics.h", |
| "persisted_logs_metrics_impl.cc", |
| "persisted_logs_metrics_impl.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_memory_stats_recorder_win.cc", |
| "system_session_analyzer_win.cc", |
| "system_session_analyzer_win.h", |
| "url_constants.cc", |
| "url_constants.h", |
| "version_utils.cc", |
| "version_utils.h", |
| ] |
| |
| public_deps = [ |
| "//third_party/metrics_proto", |
| ] |
| |
| deps = [ |
| "//base", |
| "//base:base_static", |
| "//components/prefs", |
| "//components/variations", |
| "//components/version_info:version_info", |
| "//extensions/buildflags", |
| "//third_party/zlib/google:compression_utils", |
| ] |
| |
| if (use_cobalt_customizations) { |
| sources -= [ |
| # Allows removal of unused sampled_profile.proto, which adds ~200KB to |
| # the binary. See b/290819695. |
| "call_stack_profile_metrics_provider.cc", |
| "call_stack_profile_metrics_provider.h", |
| |
| # All code should be OS agnostic above SB. |
| "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", |
| # Too many non-existent SB functionalities (e.g., base::TouchFile, |
| # MemoryMapped files, etc). |
| "file_metrics_provider.cc", |
| "file_metrics_provider.h", |
| # All code should be OS agnostic above SB. |
| "machine_id_provider_win.cc", |
| "system_memory_stats_recorder_linux.cc", |
| "system_memory_stats_recorder_win.cc", |
| "system_session_analyzer_win.cc", |
| "system_session_analyzer_win.h", |
| |
| # Files with unused symbols. ex: DriveMetricsProvider::HasSeekPenalty |
| # These files give linker errors about undefined symbols during modualr builds. |
| "drive_metrics_provider.cc", |
| "drive_metrics_provider.h", |
| ] |
| } |
| |
| if (is_chromeos) { |
| deps += [ ":serialization" ] |
| } |
| |
| if (is_mac && !use_cobalt_customizations) { |
| libs = [ |
| # The below are all needed for drive_metrics_provider_mac.mm. |
| "CoreFoundation.framework", |
| "DiskArbitration.framework", |
| "Foundation.framework", |
| "IOKit.framework", |
| ] |
| } |
| |
| if (is_win && !use_cobalt_customizations) { |
| 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 (!use_cobalt_customizations) { |
| # 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 && !use_cobalt_customizations) { |
| static_library("gpu") { |
| sources = [ |
| "gpu/gpu_metrics_provider.cc", |
| "gpu/gpu_metrics_provider.h", |
| ] |
| |
| public_deps = [ |
| ":metrics", |
| ] |
| deps = [ |
| "//base", |
| "//content/public/browser", |
| "//gpu/config", |
| ] |
| } |
| } |
| |
| if (!use_cobalt_customizations) { |
| 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/data_use_measurement/core", |
| "//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" ] |
| } |
| } |
| |
| 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/interfaces: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", |
| "child_call_stack_profile_collector.h", |
| ] |
| sources = [ |
| "call_stack_profile_builder.cc", |
| "child_call_stack_profile_collector.cc", |
| ] |
| public_deps = [ |
| ":call_stack_profile_params", |
| ] |
| deps = [ |
| "//base", |
| "//components/metrics/public/interfaces: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/interfaces:call_stack_mojo_bindings", |
| ] |
| } |
| } |
| |
| 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 && !use_cobalt_customizations) { |
| static_library("serialization") { |
| sources = [ |
| "serialization/metric_sample.cc", |
| "serialization/metric_sample.h", |
| "serialization/serialization_utils.cc", |
| "serialization/serialization_utils.h", |
| ] |
| deps = [ |
| "//base", |
| ] |
| } |
| } |
| |
| if (!use_cobalt_customizations) { |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "call_stack_profile_builder_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", |
| "drive_metrics_provider_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_unittest.cc", |
| "metrics_state_manager_unittest.cc", |
| "net/net_metrics_log_uploader_unittest.cc", |
| "net/network_metrics_provider_unittest.cc", |
| "persisted_logs_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", |
| ] |
| |
| deps = [ |
| ":call_stack_profile_builder", |
| ":component_metrics", |
| ":metrics", |
| ":net", |
| ":single_sample_metrics", |
| ":test_support", |
| ":ui", |
| "//base/test:test_support", |
| "//components/component_updater:test_support", |
| "//components/encrypted_messages:encrypted_message_proto", |
| "//components/metrics/public/cpp:call_stack_unit_tests", |
| "//components/prefs: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" ] |
| } |
| |
| # 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" ] |
| deps -= [ "//components/metrics/public/cpp:call_stack_unit_tests" ] |
| } |
| } |
| |
| # Convenience testing target |
| test("metrics_unittests") { |
| sources = [ |
| "//components/test/run_all_unittests.cc", |
| ] |
| deps = [ |
| ":unit_tests", |
| "//components/test:test_support", |
| ] |
| } |
| } |
| |
| if (use_cobalt_customizations) { |
| target(gtest_target_type, "components_metrics_tests") { |
| testonly = true |
| has_pedantic_warnings = true |
| sources = [ |
| "histogram_encoder_unittest.cc", |
| "metrics_log_manager_unittest.cc", |
| "metrics_log_store_unittest.cc", |
| "metrics_log_unittest.cc", |
| "metrics_service_unittest.cc", |
| "metrics_state_manager_unittest.cc", |
| "reporting_service_unittest.cc", |
| "stability_metrics_helper_unittest.cc", |
| "stability_metrics_provider_unittest.cc", |
| ] |
| |
| deps = [ |
| ":metrics", |
| ":test_support", |
| "//base", |
| "//base/test:test_support", |
| "//cobalt/test:run_all_unittests", |
| "//components/prefs:test_support", |
| "//components/variations", |
| "//extensions/buildflags", |
| "//testing/gtest", |
| "//third_party/zlib/google:compression_utils", |
| ] |
| } |
| } |