# Copyright 2017 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/nocompile.gni")
import("//third_party/blink/renderer/core/core.gni")
template("probe_generator") {
assert(defined(invoker.probe_set))
assert(defined(invoker.probe_sink))
assert(defined(invoker.output))
generated_target_name = target_name + "__generated"
action(generated_target_name) {
script = "../../build/scripts/make_instrumenting_probes.py"
inputs = [
"${invoker.probe_set}.pidl",
"${invoker.probe_set}.json5",
"../../build/scripts/templates/instrumenting_probes_impl.cc.tmpl",
"../../build/scripts/templates/instrumenting_probes_inl.h.tmpl",
"../../build/scripts/templates/probe_sink.h.tmpl",
]
outputs = [
"${invoker.output}/${invoker.probe_set}_inl.h",
"${invoker.output}/${invoker.probe_set}_impl.cc",
"${invoker.output}/${invoker.probe_sink}.h",
]
args = [
rebase_path(inputs[0], root_build_dir),
"--config",
rebase_path("${invoker.probe_set}.json5", root_build_dir),
"--output_dir",
rebase_path(invoker.output, root_build_dir),
]
}
source_set("${target_name}__headers") {
sources = [
"${invoker.output}/${invoker.probe_set}_inl.h",
"${invoker.output}/${invoker.probe_sink}.h",
]
deps = [ "//third_party/blink/renderer/platform" ]
public_deps = [ ":${generated_target_name}" ]
}
if (!defined(invoker.is_test) || !invoker.is_test) {
blink_core_sources(target_name) {
sources = [ "${invoker.output}/${invoker.probe_set}_impl.cc" ]
public_deps = [ ":${target_name}__headers" ]
}
}
}
probe_generator("instrumentation_probes") {
probe_set = "core_probes"
probe_sink = "core_probe_sink"
output = blink_core_output_dir
}
source_set("generated") {
deps = [ ":instrumentation_probes__generated" ]
}
# Compiles the sources generated above.
blink_core_sources("probe") {
sources = [
"async_task_context.cc",
"async_task_context.h",
"core_probes.cc",
"core_probes.h",
]
deps = [
"//skia",
"//third_party/blink/renderer/bindings/core/v8:generated",
"//third_party/blink/renderer/core:all_generators",
"//third_party/blink/renderer/platform/wtf",
"//v8",
]
public_deps = [ ":instrumentation_probes" ]
}
if (enable_nocompile_tests) {
probe_generator("test_probes") {
probe_set = "test_probes"
probe_sink = "test_probe_sink"
output = "${blink_core_output_dir}/probe"
is_test = true
}
group("blink_probes_nocompile_tests") {
# TODO(crbug.com/1480969): Empty placeholder group until the legacy
# nocompile targets are deleted from the buildbot configs.
}
nocompile_source_set("probe_nocompile_tests") {
sources = [ "probe_nocompile.nc" ]
deps = [
# We don't want to test compile errors for test_probes_impl.cc.
# So, it depends on "test_probes__headers" instead of "test_probes".
":test_probes__headers",
"//third_party/blink/renderer/platform/wtf",
"//v8",
]
}
}