Move ChromeOS hardware class init out of MetricsService.
This CL moves the initialization of the hardware class on ChromeOS out of
MetricsService and into ChromeOSMetricsProvider via ChromeMetricsServiceClient.
MetricsService now pass |OnInitTaskGotHardwareClass()| as the callback to
ChromeMetricsServiceClient::StartGatheringMetrics().
ChromeMetricsServiceClient::StartGatheringMetrics() posts a task to the FILE
thread calling ChromeMetricsServiceClient::InitTaskGetHardwareClass(). The
latter function calls into ChromeOSMetricsProvider when on ChromeOS and
directly calls the callback passed to it on other platforms.
A followup CL will move the rest of the embedder-specific initial metrics
gathering flow out of MetricsService.
BUG=375776
Review URL: https://codereview.chromium.org/301633006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273820 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h
index a7dcace1..aef2120 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.h
+++ b/chrome/browser/metrics/chrome_metrics_service_client.h
@@ -17,6 +17,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+class ChromeOSMetricsProvider;
class MetricsService;
namespace metrics {
@@ -54,6 +55,9 @@
explicit ChromeMetricsServiceClient(
metrics::MetricsStateManager* state_manager);
+ // Completes the two-phase initialization of ChromeMetricsServiceClient.
+ void Initialize();
+
// Callbacks for various stages of final log info collection. Do not call
// these directly.
void OnMemoryDetailCollectionDone();
@@ -81,11 +85,18 @@
base::ThreadChecker thread_checker_;
+ // Weak pointer to the MetricsStateManager.
+ metrics::MetricsStateManager* metrics_state_manager_;
+
// The MetricsService that |this| is a client of.
scoped_ptr<MetricsService> metrics_service_;
content::NotificationRegistrar registrar_;
+ // On ChromeOS, holds a weak pointer to the ChromeOSMetricsProvider instance
+ // that has been registered with MetricsService. On other platforms, is NULL.
+ ChromeOSMetricsProvider* chromeos_metrics_provider_;
+
NetworkStatsUploader network_stats_uploader_;
// Saved callback received from CollectFinalMetrics().