chromium/components/heap_profiling/in_process/BUILD.gn

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

import("//base/allocator/allocator.gni")
import("//mojo/public/tools/bindings/mojom.gni")

mojom("mojom") {
  sources = [ "mojom/snapshot_controller.mojom" ]
  deps = [ "//mojo/public/mojom/base" ]
}

mojom("test_mojom") {
  sources = [ "mojom/test_connector.mojom" ]
  deps = [
    ":mojom",
    "//components/metrics/public/mojom:call_stack_mojo_bindings",
  ]
}

source_set("in_process") {
  # HeapProfilerController's dependencies are not compiled on iOS unless
  # use_allocator_shim is true.
  if (!is_ios || use_allocator_shim) {
    sources = [
      "browser_process_snapshot_controller.cc",
      "browser_process_snapshot_controller.h",
      "child_process_snapshot_controller.cc",
      "child_process_snapshot_controller.h",
      "heap_profiler_controller.cc",
      "heap_profiler_controller.h",
      "heap_profiler_parameters.cc",
      "heap_profiler_parameters.h",
      "switches.cc",
      "switches.h",
    ]

    deps = [
      ":mojom",
      "//base",
      "//components/metrics",
      "//components/metrics:child_call_stack_profile_builder",
      "//components/services/heap_profiling/public/cpp:cpp",
      "//components/variations",
      "//components/version_info",
      "//mojo/public/cpp/bindings",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  # HeapProfilerController's dependencies are not compiled on iOS unless
  # use_allocator_shim is true.
  if (!is_ios || use_allocator_shim) {
    sources = [
      "heap_profiler_controller_unittest.cc",
      "heap_profiler_parameters_unittest.cc",
    ]
    deps = [
      ":in_process",
      ":mojom",
      ":test_mojom",
      "//base/test:test_support",
      "//components/metrics",
      "//components/metrics:child_call_stack_profile_builder",
      "//components/metrics/public/mojom:call_stack_mojo_bindings",
      "//components/variations",
      "//components/version_info",
      "//mojo/core/test:test_support",
      "//mojo/public/cpp/bindings",
    ]
  }
}