[go: nahoru, domu]

base: Hide tracing support behind a gn arg

In order to support Perfetto-powered typed trace events in //base, we
will add a dependency on //third_party/perfetto. This dependency would
be hard to support in libchrome -- for that reason, we're making
tracing support in //base optional at build time.

This patch introduces a gn arg that enables base's tracing support.
Disabling it is not supported in Chrome, but base_unittests and
libchrome can also be built & run with enable_base_tracing=false.

When support is disabled, a large part of the TRACE_EVENT API surface
is mocked out with an empty implementation, so that few other places in
//base code require preprocessor ifdefs.

Doc: https://docs.google.com/document/d/1UQ4Ez7B-TeowijOUuMXuoWj1amZcQ7E2abt3s4jaAEY/edit?usp=sharing
Test: args.gn: enable_base_tracing=false
Bug: 1065905,1006541
Change-Id: I067e85411c51659626af0713ccfa6c18cfffc3e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207225
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774081}
diff --git a/base/util/memory_pressure/multi_source_memory_pressure_monitor.cc b/base/util/memory_pressure/multi_source_memory_pressure_monitor.cc
index 74f9663..576a837 100644
--- a/base/util/memory_pressure/multi_source_memory_pressure_monitor.cc
+++ b/base/util/memory_pressure/multi_source_memory_pressure_monitor.cc
@@ -9,7 +9,7 @@
 #include "base/metrics/histogram_functions.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/time/time.h"
-#include "base/trace_event/trace_event.h"
+#include "base/trace_event/base_tracing.h"
 #include "base/util/memory_pressure/system_memory_pressure_evaluator.h"
 
 namespace util {