0

gin: Define V8_USE_PERFETTO when building with Perfetto

Make sure the V8_USE_PERFETTO is defined when building the gin bindings
with Perfetto enabled. Otherwise v8 and gin will be built using
mismatching values of this definition, leading to subtle
incompatibilities.

Bug: 1006541
Cq-Include-Trybots: luci.chromium.try:linux-perfetto-rel
Change-Id: Ib99c53de684f3d04bbb8c5f95d4e130cbefe207b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611266
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840547}
This commit is contained in:
Sami Kyostila
2021-01-06 10:15:19 +00:00
committed by Chromium LUCI CQ
parent 40b5855b68
commit 88a4d55ef0
2 changed files with 7 additions and 0 deletions

@ -75,6 +75,10 @@ component("gin") {
defines = [ "GIN_IMPLEMENTATION" ]
if (use_perfetto_client_library) {
defines += [ "V8_USE_PERFETTO" ]
}
public_deps = [
"//base",
"//v8",

@ -22,6 +22,7 @@
#include "base/task/task_traits.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/tracing_buildflags.h"
#include "build/build_config.h"
#include "gin/per_isolate_data.h"
@ -371,6 +372,7 @@ class V8Platform::TracingControllerImpl : public v8::TracingController {
~TracingControllerImpl() override = default;
// TracingController implementation.
#if !BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
const uint8_t* GetCategoryGroupEnabled(const char* name) override {
return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name);
}
@ -438,6 +440,7 @@ class V8Platform::TracingControllerImpl : public v8::TracingController {
TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_enabled_flag, name,
traceEventHandle);
}
#endif // !BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
void AddTraceStateObserver(TraceStateObserver* observer) override {
g_trace_state_dispatcher.Get().AddObserver(observer);
}