summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-23 10:55:55 +0000
committerblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-23 10:55:55 +0000
commit06c1083927f7716feea13304ce5c7b8d0c2459b9 (patch)
tree560d1941f4f60a53f87337b7db1deb366d9c957d
parent03608f12bac455861d8a55e5d25d4e3450aefc13 (diff)
downloadchromium_src-06c1083927f7716feea13304ce5c7b8d0c2459b9.zip
chromium_src-06c1083927f7716feea13304ce5c7b8d0c2459b9.tar.gz
chromium_src-06c1083927f7716feea13304ce5c7b8d0c2459b9.tar.bz2
Introduce MetricsServiceClient::StartGatheringMetrics
This API is called when initial metrics gathering should start, and takes in a callback that is called when initial metrics gathering is complete. It is currently empty but will be filled in as initial metrics gathering code moves out of MetricsService. BUG=374231 R=asvitkine@chromium.org Review URL: https://codereview.chromium.org/299663011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272479 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/metrics/chrome_metrics_service_client.cc7
-rw-r--r--chrome/browser/metrics/chrome_metrics_service_client.h2
-rw-r--r--chrome/browser/metrics/metrics_service.cc5
-rw-r--r--components/metrics/metrics_service_client.h4
-rw-r--r--components/metrics/test_metrics_service_client.cc5
-rw-r--r--components/metrics/test_metrics_service_client.h2
6 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc
index 580aa13..b1c161d 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/metrics/chrome_metrics_service_client.h"
#include "base/bind.h"
+#include "base/callback.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
@@ -282,3 +283,9 @@ void ChromeMetricsServiceClient::Observe(
NOTREACHED();
}
}
+
+void ChromeMetricsServiceClient::StartGatheringMetrics(
+ const base::Closure& done_callback) {
+ // TODO(blundell): Move metrics gathering tasks from MetricsService to here.
+ done_callback.Run();
+}
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h
index e21dde6..7ed043e 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.h
+++ b/chrome/browser/metrics/chrome_metrics_service_client.h
@@ -34,6 +34,8 @@ class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE;
virtual std::string GetVersionString() OVERRIDE;
virtual void OnLogUploadComplete() OVERRIDE;
+ virtual void StartGatheringMetrics(
+ const base::Closure& done_callback) OVERRIDE;
virtual void CollectFinalMetrics(const base::Closure& done_callback)
OVERRIDE;
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 9392702..354315a 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -943,6 +943,11 @@ void MetricsService::OpenNewLog() {
// We only need to schedule that run once.
state_ = INIT_TASK_SCHEDULED;
+ // TODO(blundell): Change the callback to be
+ // FinishedReceivingProfilerData() when the initial metrics gathering is
+ // moved to ChromeMetricsServiceClient.
+ client_->StartGatheringMetrics(base::Bind(&base::DoNothing));
+
// Schedules a task on the file thread for execution of slower
// initialization steps (such as plugin list generation) necessary
// for sending the initial log. This avoids blocking the main UI
diff --git a/components/metrics/metrics_service_client.h b/components/metrics/metrics_service_client.h
index d900d7e..dbad4a3 100644
--- a/components/metrics/metrics_service_client.h
+++ b/components/metrics/metrics_service_client.h
@@ -42,6 +42,10 @@ class MetricsServiceClient {
// Called by the metrics service when a log has been uploaded.
virtual void OnLogUploadComplete() = 0;
+ // Starts gathering metrics, calling |done_callback| when initial metrics
+ // gathering is complete.
+ virtual void StartGatheringMetrics(const base::Closure& done_callback) = 0;
+
// Called prior to a metrics log being closed, allowing the client to collect
// extra histograms that will go in that log. Asynchronous API - the client
// implementation should call |done_callback| when complete.
diff --git a/components/metrics/test_metrics_service_client.cc b/components/metrics/test_metrics_service_client.cc
index 64bdcfc..891b90f 100644
--- a/components/metrics/test_metrics_service_client.cc
+++ b/components/metrics/test_metrics_service_client.cc
@@ -45,6 +45,11 @@ std::string TestMetricsServiceClient::GetVersionString() {
void TestMetricsServiceClient::OnLogUploadComplete() {
}
+void TestMetricsServiceClient::StartGatheringMetrics(
+ const base::Closure& done_callback) {
+ done_callback.Run();
+}
+
void TestMetricsServiceClient::CollectFinalMetrics(
const base::Closure& done_callback) {
done_callback.Run();
diff --git a/components/metrics/test_metrics_service_client.h b/components/metrics/test_metrics_service_client.h
index f00aade..b5b7ba9 100644
--- a/components/metrics/test_metrics_service_client.h
+++ b/components/metrics/test_metrics_service_client.h
@@ -28,6 +28,8 @@ class TestMetricsServiceClient : public MetricsServiceClient {
virtual SystemProfileProto::Channel GetChannel() OVERRIDE;
virtual std::string GetVersionString() OVERRIDE;
virtual void OnLogUploadComplete() OVERRIDE;
+ virtual void StartGatheringMetrics(
+ const base::Closure& done_callback) OVERRIDE;
virtual void CollectFinalMetrics(const base::Closure& done_callback)
OVERRIDE;