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

Unified Diff: content/browser/histogram_synchronizer.h

Issue 2412903002: Remove MessageLoop::current() from chrome_metrics_service_client.cc (Closed)
Patch Set: Created 4 years, 2 months 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/chrome_metrics_service_client.cc ('k') | content/browser/histogram_synchronizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/histogram_synchronizer.h
diff --git a/content/browser/histogram_synchronizer.h b/content/browser/histogram_synchronizer.h
index 4180c24f9946196ebfe629d96077184c8dbb93f1..2e9b79539dcd8b55bed9103fc494885fc4a8c68f 100644
--- a/content/browser/histogram_synchronizer.h
+++ b/content/browser/histogram_synchronizer.h
@@ -12,13 +12,10 @@
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
+#include "base/task_runner.h"
#include "base/time/time.h"
#include "content/browser/histogram_subscriber.h"
-namespace base {
-class MessageLoop;
-}
-
namespace content {
// This class maintains state that is used to upload histogram data from the
@@ -68,11 +65,12 @@ class HistogramSynchronizer : public HistogramSubscriber {
// Contact all child processes, and get them to upload to the browser any/all
// changes to histograms. When all changes have been acquired, or when the
- // wait time expires (whichever is sooner), post the callback to the
- // specified message loop. Note the callback is posted exactly once.
- static void FetchHistogramsAsynchronously(base::MessageLoop* callback_thread,
- const base::Closure& callback,
- base::TimeDelta wait_time);
+ // wait time expires (whichever is sooner), post the callback to the specified
+ // TaskRunner. Note the callback is posted exactly once.
+ static void FetchHistogramsAsynchronously(
+ scoped_refptr<base::TaskRunner> task_runner,
+ const base::Closure& callback,
+ base::TimeDelta wait_time);
private:
friend struct base::DefaultSingletonTraits<HistogramSynchronizer>;
@@ -106,18 +104,18 @@ class HistogramSynchronizer : public HistogramSubscriber {
int sequence_number,
const std::vector<std::string>& pickled_histograms) override;
- // Set the callback_thread_ and callback_ members. If these members already
- // had values, then as a side effect, post the old callback_ to the old
- // callaback_thread_. This side effect should not generally happen, but is in
- // place to assure correctness (that any tasks that were set, are eventually
- // called, and never merely discarded).
- void SetCallbackTaskAndThread(base::MessageLoop* callback_thread,
+ // Set the |callback_task_runner_| and |callback_| members. If these members
+ // already had values, then as a side effect, post the old |callback_| to the
+ // old |callback_task_runner_|. This side effect should not generally happen,
+ // but is in place to assure correctness (that any tasks that were set, are
+ // eventually called, and never merely discarded).
+ void SetTaskRunnerAndCallback(scoped_refptr<base::TaskRunner> task_runner,
const base::Closure& callback);
void ForceHistogramSynchronizationDoneCallback(int sequence_number);
// Internal helper function, to post task, and record callback stats.
- void InternalPostTask(base::MessageLoop* thread,
+ void InternalPostTask(scoped_refptr<base::TaskRunner> task_runner,
const base::Closure& callback);
// Gets a new sequence number to be sent to processes from browser process.
@@ -127,10 +125,10 @@ class HistogramSynchronizer : public HistogramSubscriber {
base::Lock lock_;
// When a request is made to asynchronously update the histograms, we store
- // the task and thread we use to post a completion notification in
- // callback_ and callback_thread_.
+ // the task and TaskRunner we use to post a completion notification in
+ // |callback_| and |callback_task_runner_|.
base::Closure callback_;
- base::MessageLoop* callback_thread_;
+ scoped_refptr<base::TaskRunner> callback_task_runner_;
// We don't track the actual processes that are contacted for an update, only
// the count of the number of processes, and we can sometimes time-out and
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.cc ('k') | content/browser/histogram_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698