Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5504)

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 8603013: base::Bind() conversion for MetricsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 14d164c8d3a8eeac812c2e0da5ba9306ad4e2f6a..4191d5cad08b1615ff40b3ff8ac811c26219ca20 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -264,16 +264,17 @@ struct MetricsService::ChildProcessStats {
// Will run the provided task after finished.
class MetricsMemoryDetails : public MemoryDetails {
public:
- explicit MetricsMemoryDetails(Task* completion) : completion_(completion) {}
+ explicit MetricsMemoryDetails(const base::Closure& callback)
+ : callback_(callback) {}
virtual void OnDetailsAvailable() {
- MessageLoop::current()->PostTask(FROM_HERE, completion_);
+ MessageLoop::current()->PostTask(FROM_HERE, callback_);
}
private:
~MetricsMemoryDetails() {}
- Task* completion_;
+ base::Closure callback_;
DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails);
};
@@ -875,10 +876,12 @@ void MetricsService::StartScheduledUpload() {
DCHECK(!waiting_for_asynchronus_reporting_step_);
waiting_for_asynchronus_reporting_step_ = true;
- Task* task = log_sender_factory_.
- NewRunnableMethod(&MetricsService::OnMemoryDetailCollectionDone);
+ base::Closure callback =
+ base::Bind(&MetricsService::OnMemoryDetailCollectionDone,
+ log_sender_factory_.GetWeakPtr());
- scoped_refptr<MetricsMemoryDetails> details(new MetricsMemoryDetails(task));
+ scoped_refptr<MetricsMemoryDetails> details(
+ new MetricsMemoryDetails(callback));
details->StartFetch();
// Collect WebCore cache information to put into a histogram.
@@ -902,8 +905,9 @@ void MetricsService::OnMemoryDetailCollectionDone() {
// OnHistogramSynchronizationDone to continue processing.
// Create a callback_task for OnHistogramSynchronizationDone.
- Task* callback_task = log_sender_factory_.NewRunnableMethod(
- &MetricsService::OnHistogramSynchronizationDone);
+ base::Closure callback = base::Bind(
+ &MetricsService::OnHistogramSynchronizationDone,
+ log_sender_factory_.GetWeakPtr());
base::StatisticsRecorder::CollectHistogramStats("Browser");
@@ -911,7 +915,7 @@ void MetricsService::OnMemoryDetailCollectionDone() {
// renderer processes. Wait time specifies how long to wait before absolutely
// calling us back on the task.
HistogramSynchronizer::FetchRendererHistogramsAsynchronously(
- MessageLoop::current(), callback_task,
+ MessageLoop::current(), callback,
kMaxHistogramGatheringWaitDuration);
}
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698