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 <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Sami Kyöstilä <[email protected]>
Cr-Commit-Position: refs/heads/master@{#774081}
diff --git a/base/values.h b/base/values.h
index 8d1ede3f..ffd2c59 100644
--- a/base/values.h
+++ b/base/values.h
@@ -533,8 +533,9 @@
   // TODO(crbug.com/646113): Delete this and migrate callsites.
   bool Equals(const Value* other) const;
 
-  // Estimates dynamic memory usage.
-  // See base/trace_event/memory_usage_estimator.h for more info.
+  // Estimates dynamic memory usage. Requires tracing support
+  // (enable_base_tracing gn flag), otherwise always returns 0. See
+  // base/trace_event/memory_usage_estimator.h for more info.
   size_t EstimateMemoryUsage() const;
 
  protected: