chromium/services/tracing/public/mojom/BUILD.gn

# 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.

import("//build/config/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")

mojom_component("mojom") {
  output_prefix = "tracing_mojom"
  macro_prefix = "TRACING_MOJOM"
  enabled_features = []

  if (is_linux || is_chromeos) {
    enabled_features += [ "is_linux_or_chromeos" ]
  }

  sources = [
    "background_tracing_agent.mojom",
    "system_tracing_service.mojom",
    "traced_process.mojom",
    "tracing_service.mojom",
  ]

  public_deps = [
    "//mojo/public/mojom/base",
    "//sandbox/policy/mojom",
  ]

  if (!is_nacl && use_blink) {
    enabled_features += [ "is_perfetto_supported_os" ]
    sources += [
      "constants.mojom",
      "perfetto_service.mojom",
    ]

    cpp_typemaps = [
      {
        types = [
          {
            mojom = "tracing.mojom.BufferFillPolicy"
            cpp = "::perfetto::TraceConfig::BufferConfig::FillPolicy"
          },
          {
            mojom = "tracing.mojom.CommitDataRequest"
            cpp = "::perfetto::CommitDataRequest"
          },
          {
            mojom = "tracing.mojom.ChunksToMove"
            cpp = "::perfetto::CommitDataRequest::ChunksToMove"
          },
          {
            mojom = "tracing.mojom.ChunkPatch"
            cpp = "::perfetto::CommitDataRequest::ChunkToPatch::Patch"
          },
          {
            mojom = "tracing.mojom.ChunkToPatch"
            cpp = "::perfetto::CommitDataRequest::ChunkToPatch"
          },
          {
            mojom = "tracing.mojom.DataSourceConfig"
            cpp = "::perfetto::DataSourceConfig"
          },
          {
            mojom = "tracing.mojom.ChromeConfig"
            cpp = "::perfetto::ChromeConfig"
          },
          {
            mojom = "tracing.mojom.DataSourceRegistration"
            cpp = "::perfetto::DataSourceDescriptor"
          },
          {
            mojom = "tracing.mojom.PerfettoBuiltinDataSource"
            cpp = "::perfetto::TraceConfig::BuiltinDataSource"
          },
          {
            mojom = "tracing.mojom.IncrementalStateConfig"
            cpp = "::perfetto::TraceConfig::IncrementalStateConfig"
          },
          {
            mojom = "tracing.mojom.TraceConfig"
            cpp = "::perfetto::TraceConfig"
          },
        ]
        traits_headers = [
          "//third_party/perfetto/include/perfetto/ext/tracing/core/commit_data_request.h",
          "//third_party/perfetto/include/perfetto/tracing/core/data_source_config.h",
          "//third_party/perfetto/include/perfetto/tracing/core/data_source_descriptor.h",
          "//third_party/perfetto/include/perfetto/tracing/core/chrome_config.h",
          "//third_party/perfetto/protos/perfetto/config/interceptor_config.gen.h",
          "//third_party/perfetto/include/perfetto/tracing/core/trace_config.h",
        ]
        traits_private_headers = [
          "chrome_config_mojom_traits.h",
          "commit_data_request_mojom_traits.h",
          "data_source_config_mojom_traits.h",
          "data_source_descriptor_mojom_traits.h",
          "interceptor_config_mojom_traits.h",
          "console_config_mojom_traits.h",
          "trace_config_mojom_traits.h",
        ]
        traits_sources = [
          "chrome_config_mojom_traits.cc",
          "commit_data_request_mojom_traits.cc",
          "console_config_mojom_traits.cc",
          "data_source_config_mojom_traits.cc",
          "data_source_descriptor_mojom_traits.cc",
          "interceptor_config_mojom_traits.cc",
          "trace_config_mojom_traits.cc",
        ]
        traits_public_deps = [ "//third_party/perfetto:libperfetto" ]
      },
    ]
  }
}