| # Copyright 2018 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # There should be only one tracing service. It is currently |
| # in the browser process. So, only //content/browser should link to this target. |
| # Others modules should only need the public targets. |
| |
| import("//build/config/compiler/compiler.gni") |
| import("//services/tracing/public/cpp/stack_sampling/loader_lock_sampling.gni") |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| import("//third_party/jni_zero/jni_zero.gni") |
| } |
| |
| source_set("lib") { |
| sources = [ |
| "perfetto/consumer_host.cc", |
| "perfetto/consumer_host.h", |
| "perfetto/perfetto_service.cc", |
| "perfetto/perfetto_service.h", |
| "perfetto/producer_host.cc", |
| "perfetto/producer_host.h", |
| "tracing_service.cc", |
| "tracing_service.h", |
| ] |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| |
| public_deps = [ |
| ":privacy_check", |
| "//base", |
| "//build:blink_buildflags", |
| "//mojo/public/cpp/bindings", |
| "//services/tracing/public/cpp", |
| "//services/tracing/public/mojom:mojom", |
| "//third_party/perfetto:libperfetto", |
| "//third_party/perfetto/include/perfetto/ext/trace_processor:export_json", |
| "//third_party/perfetto/include/perfetto/trace_processor:basic_types", |
| "//third_party/perfetto/include/perfetto/trace_processor:storage", |
| "//third_party/perfetto/protos/perfetto/config:lite", |
| ] |
| } |
| |
| source_set("privacy_check") { |
| sources = [ |
| "perfetto/privacy_filtered_fields-inl.h", |
| "perfetto/privacy_filtering_check.cc", |
| "perfetto/privacy_filtering_check.h", |
| ] |
| |
| deps = [ |
| "//base", |
| "//third_party/perfetto:libperfetto", |
| ] |
| } |
| |
| source_set("test_utils") { |
| testonly = true |
| |
| sources = [ |
| "perfetto/test_utils.cc", |
| "perfetto/test_utils.h", |
| "public/cpp/perfetto/producer_test_utils.cc", |
| "public/cpp/perfetto/producer_test_utils.h", |
| ] |
| |
| deps = [ |
| ":lib", |
| "//base", |
| "//base/test:test_support", |
| "//testing/gtest", |
| "//third_party/perfetto/protos/perfetto/common:lite", |
| "//third_party/perfetto/protos/perfetto/trace:lite", |
| "//third_party/perfetto/protos/perfetto/trace/chrome:lite", |
| ] |
| |
| if (is_posix) { |
| sources += [ |
| "perfetto/system_test_utils.cc", |
| "perfetto/system_test_utils.h", |
| ] |
| } |
| } |
| |
| source_set("tests") { |
| testonly = true |
| |
| sources = [ |
| "perfetto/consumer_host_unittest.cc", |
| "perfetto/perfetto_integration_unittest.cc", |
| "perfetto/privacy_filtering_check_unittest.cc", |
| "public/cpp/perfetto/perfetto_config_unittest.cc", |
| "public/cpp/perfetto/trace_event_data_source_unittest.cc", |
| "public/cpp/perfetto/trace_packet_tokenizer_unittest.cc", |
| "public/cpp/perfetto/traced_value_proto_writer_unittest.cc", |
| "public/cpp/stack_sampling/tracing_sampler_profiler_unittest.cc", |
| ] |
| |
| deps = [ |
| ":lib", |
| ":privacy_check", |
| ":test_utils", |
| "//base", |
| "//base:base_stack_sampling_profiler_test_util", |
| "//base/test:proto_test_support", |
| "//base/test:test_support", |
| "//build:chromeos_buildflags", |
| "//mojo/public/cpp/bindings", |
| "//services/tracing/public/cpp:buildflags", |
| "//services/tracing/public/cpp/background_tracing:unit_tests", |
| "//services/tracing/public/mojom:mojom", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//third_party/perfetto/include/perfetto/protozero:protozero", |
| "//third_party/perfetto/protos/perfetto/common:lite", |
| "//third_party/perfetto/protos/perfetto/trace:lite", |
| "//third_party/perfetto/protos/perfetto/trace/chrome:lite", |
| "//third_party/perfetto/protos/perfetto/trace/interned_data:lite", |
| "//third_party/perfetto/protos/perfetto/trace/profiling:lite", |
| "//third_party/perfetto/protos/perfetto/trace/track_event:lite", |
| ] |
| |
| if (is_android) { |
| sources += [ |
| "public/cpp/perfetto/java_heap_profiler/hprof_buffer_android_unittest.cc", |
| "public/cpp/perfetto/java_heap_profiler/hprof_parser_android_unittest.cc", |
| ] |
| } |
| |
| if (!is_android) { |
| sources += [ "tracing_service_unittest.cc" ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ |
| "public/cpp/perfetto/fuchsia_perfetto_producer_connector_unittest.cc", |
| ] |
| deps += [ |
| "//net", |
| "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.tracing.perfetto:fuchsia.tracing.perfetto_cpp", |
| "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", |
| ] |
| } |
| |
| if (is_posix) { |
| # TODO(crbug.com/1184180): System perfetto tests are flaky on Mac. |
| if (!is_apple) { |
| sources += [ "perfetto/system_perfetto_unittest.cc" ] |
| } |
| |
| if (!is_android && !is_ios) { |
| # TODO(crbug.com/1451751): Failed on iOS by '(errno: 63, File name too long)'. |
| sources += [ "public/cpp/system_tracing_service_unittest.cc" ] |
| } |
| } |
| |
| data_deps = [ "//third_party/perfetto/protos/perfetto/config:descriptor" ] |
| data = [ "$root_gen_dir/third_party/perfetto/protos/perfetto/config/config.descriptor" ] |
| |
| if (enable_loader_lock_sampling) { |
| if (is_win) { |
| sources += |
| [ "public/cpp/stack_sampling/loader_lock_sampler_win_unittest.cc" ] |
| } |
| |
| deps += [ ":loader_lock_sampler_test_strings" ] |
| data_deps += [ ":loader_lock_sampler_test_dll" ] |
| } |
| } |
| |
| if (is_android) { |
| generate_jni("jni_headers") { |
| testonly = true |
| sources = [ "android/test/src/org/chromium/tracing/UnwindTestHelper.java" ] |
| } |
| |
| android_library("tracing_test_helper_java") { |
| testonly = true |
| deps = [ "//third_party/jni_zero:jni_zero_java" ] |
| sources = [ "android/test/src/org/chromium/tracing/UnwindTestHelper.java" ] |
| } |
| } |
| |
| if (enable_loader_lock_sampling) { |
| source_set("loader_lock_sampler_test_strings") { |
| testonly = true |
| |
| sources = [ |
| "public/cpp/stack_sampling/loader_lock_sampler_test_strings.cc", |
| "public/cpp/stack_sampling/loader_lock_sampler_test_strings.h", |
| ] |
| } |
| |
| loadable_module("loader_lock_sampler_test_dll") { |
| testonly = true |
| |
| sources = [ "public/cpp/stack_sampling/loader_lock_sampler_test_dll.cc" ] |
| |
| deps = [ ":loader_lock_sampler_test_strings" ] |
| } |
| } |
| |
| if (is_ios) { |
| bundle_data("services_tracing_perfetto_bundle_data") { |
| testonly = true |
| _relative_path = "third_party/perfetto/protos/perfetto/config" |
| public_deps = [ "//third_party/perfetto/protos/perfetto/config:descriptor" ] |
| sources = [ "$root_gen_dir/$_relative_path/config.descriptor" ] |
| outputs = |
| [ "{{bundle_resources_dir}}/gen/$_relative_path/{{source_file_part}}" ] |
| } |
| } |