Use system_monitor to gather the System Stats chrome://tracing data

This removes all the PostTask / Timer logic from
trace_event_system_stats_monitor and make it use SystemMonitor instead.

This simplify the trace_event_system_stats_monitor code and will make it
possible to add more system metrics to the system_stats tracing
category (the goal is to replace some of these raw numbers by some more
useful ones as they're currently really easy to misinterpret)

Change-Id: I6ea2ab5c4f12f329b5f28d3b84ab48efb57710d3
Reviewed-on: https://chromium-review.googlesource.com/c/1446772
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: oysteine <[email protected]>
Commit-Queue: Sébastien Marchand <[email protected]>
Cr-Commit-Position: refs/heads/master@{#636297}
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h
index 45b0dae..ae86339 100644
--- a/chrome/browser/chrome_browser_main.h
+++ b/chrome/browser/chrome_browser_main.h
@@ -6,6 +6,7 @@
 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_
 
 #include <memory>
+#include <vector>
 
 #include "base/macros.h"
 #include "build/build_config.h"
@@ -33,6 +34,10 @@
 class TraceEventSystemStatsMonitor;
 }
 
+namespace performance_monitor {
+class SystemMonitor;
+}
+
 class ChromeBrowserMainParts : public content::BrowserMainParts {
  public:
   ~ChromeBrowserMainParts() override;
@@ -158,6 +163,10 @@
   // the reporting pipeline.
   std::unique_ptr<HeapProfilerController> heap_profiler_controller_;
 
+  // The system monitor instance, used by some subsystems to collect the system
+  // metrics they need.
+  std::unique_ptr<performance_monitor::SystemMonitor> system_monitor_;
+
   // The system stats monitor used by chrome://tracing. This doesn't do anything
   // until tracing of the |system_stats| category is enabled.
   std::unique_ptr<tracing::TraceEventSystemStatsMonitor>