chromium/chrome/common/profiler/BUILD.gn

# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//extensions/buildflags/buildflags.gni")

source_set("profiler") {
  public = [
    "main_thread_stack_sampling_profiler.h",
    "process_type.h",
    "thread_profiler.h",
    "thread_profiler_configuration.h",
    "unwind_util.h",
  ]

  sources = [
    "main_thread_stack_sampling_profiler.cc",
    "process_type.cc",
    "thread_profiler.cc",
    "thread_profiler_configuration.cc",
    "thread_profiler_platform_configuration.cc",
    "thread_profiler_platform_configuration.h",
    "unwind_util.cc",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [
    "//base",
    "//build:branding_buildflags",
    "//chrome/common:channel_info",
    "//chrome/common:non_code_constants",
    "//components/metrics",
    "//components/metrics:call_stack_profile_builder",
    "//components/metrics/public/mojom:call_stack_mojo_bindings",
    "//components/version_info:version_info",
    "//content/public/common",
    "//extensions/buildflags",
    "//third_party/abseil-cpp:absl",
  ]

  if (is_android) {
    deps += [
      "//chrome/android/features/stack_unwinder/public:native",
      "//chrome/android/modules/stack_unwinder/public:module",
    ]
    public += [ "native_unwinder_android_map_delegate_impl.h" ]
    sources += [ "native_unwinder_android_map_delegate_impl.cc" ]
  }

  if (enable_extensions) {
    deps += [ "//extensions/common:common" ]
  }

  friend = [ ":unit_tests" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "process_type_unittest.cc",
    "thread_profiler_platform_configuration_unittest.cc",
    "thread_profiler_unittest.cc",
    "unwind_util_unittest.cc",
  ]

  deps = [
    ":profiler",
    "//base/test:test_support",
    "//build:branding_buildflags",
    "//chrome/common:channel_info",
    "//chrome/common:non_code_constants",
    "//components/metrics",
    "//components/metrics:call_stack_profile_builder",
    "//components/version_info:version_info",
    "//content/public/common",
    "//extensions/buildflags",
  ]

  if (enable_extensions) {
    deps += [ "//extensions/common:common" ]
  }
}