Commit 06c10839 authored by blundell@chromium.org's avatar blundell@chromium.org

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
parent 03608f12
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/metrics/chrome_metrics_service_client.h" #include "chrome/browser/metrics/chrome_metrics_service_client.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
...@@ -282,3 +283,9 @@ void ChromeMetricsServiceClient::Observe( ...@@ -282,3 +283,9 @@ void ChromeMetricsServiceClient::Observe(
NOTREACHED(); NOTREACHED();
} }
} }
void ChromeMetricsServiceClient::StartGatheringMetrics(
const base::Closure& done_callback) {
// TODO(blundell): Move metrics gathering tasks from MetricsService to here.
done_callback.Run();
}
...@@ -34,6 +34,8 @@ class ChromeMetricsServiceClient : public metrics::MetricsServiceClient, ...@@ -34,6 +34,8 @@ class ChromeMetricsServiceClient : public metrics::MetricsServiceClient,
virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE; virtual metrics::SystemProfileProto::Channel GetChannel() OVERRIDE;
virtual std::string GetVersionString() OVERRIDE; virtual std::string GetVersionString() OVERRIDE;
virtual void OnLogUploadComplete() OVERRIDE; virtual void OnLogUploadComplete() OVERRIDE;
virtual void StartGatheringMetrics(
const base::Closure& done_callback) OVERRIDE;
virtual void CollectFinalMetrics(const base::Closure& done_callback) virtual void CollectFinalMetrics(const base::Closure& done_callback)
OVERRIDE; OVERRIDE;
......
...@@ -943,6 +943,11 @@ void MetricsService::OpenNewLog() { ...@@ -943,6 +943,11 @@ void MetricsService::OpenNewLog() {
// We only need to schedule that run once. // We only need to schedule that run once.
state_ = INIT_TASK_SCHEDULED; 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 // Schedules a task on the file thread for execution of slower
// initialization steps (such as plugin list generation) necessary // initialization steps (such as plugin list generation) necessary
// for sending the initial log. This avoids blocking the main UI // for sending the initial log. This avoids blocking the main UI
......
...@@ -42,6 +42,10 @@ class MetricsServiceClient { ...@@ -42,6 +42,10 @@ class MetricsServiceClient {
// Called by the metrics service when a log has been uploaded. // Called by the metrics service when a log has been uploaded.
virtual void OnLogUploadComplete() = 0; 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 // 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 // extra histograms that will go in that log. Asynchronous API - the client
// implementation should call |done_callback| when complete. // implementation should call |done_callback| when complete.
......
...@@ -45,6 +45,11 @@ std::string TestMetricsServiceClient::GetVersionString() { ...@@ -45,6 +45,11 @@ std::string TestMetricsServiceClient::GetVersionString() {
void TestMetricsServiceClient::OnLogUploadComplete() { void TestMetricsServiceClient::OnLogUploadComplete() {
} }
void TestMetricsServiceClient::StartGatheringMetrics(
const base::Closure& done_callback) {
done_callback.Run();
}
void TestMetricsServiceClient::CollectFinalMetrics( void TestMetricsServiceClient::CollectFinalMetrics(
const base::Closure& done_callback) { const base::Closure& done_callback) {
done_callback.Run(); done_callback.Run();
......
...@@ -28,6 +28,8 @@ class TestMetricsServiceClient : public MetricsServiceClient { ...@@ -28,6 +28,8 @@ class TestMetricsServiceClient : public MetricsServiceClient {
virtual SystemProfileProto::Channel GetChannel() OVERRIDE; virtual SystemProfileProto::Channel GetChannel() OVERRIDE;
virtual std::string GetVersionString() OVERRIDE; virtual std::string GetVersionString() OVERRIDE;
virtual void OnLogUploadComplete() OVERRIDE; virtual void OnLogUploadComplete() OVERRIDE;
virtual void StartGatheringMetrics(
const base::Closure& done_callback) OVERRIDE;
virtual void CollectFinalMetrics(const base::Closure& done_callback) virtual void CollectFinalMetrics(const base::Closure& done_callback)
OVERRIDE; OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment