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

Side by Side Diff: chrome/browser/metrics/histogram_synchronizer.cc

Issue 8536054: Migrate several instances of NewRunnableMethod to base::Bind in browser/metrics (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/histogram_synchronizer.h" 5 #include "chrome/browser/metrics/histogram_synchronizer.h"
6 6
7 #include "base/bind.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
9 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
10 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
11 #include "chrome/common/render_messages.h" 12 #include "chrome/common/render_messages.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 15
15 using base::Time; 16 using base::Time;
16 using base::TimeDelta; 17 using base::TimeDelta;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 callback_task); 95 callback_task);
95 96
96 int sequence_number = 97 int sequence_number =
97 current_synchronizer->NotifyAllRenderers(ASYNC_HISTOGRAMS); 98 current_synchronizer->NotifyAllRenderers(ASYNC_HISTOGRAMS);
98 99
99 // Post a task that would be called after waiting for wait_time. This acts 100 // Post a task that would be called after waiting for wait_time. This acts
100 // as a watchdog, to ensure that a non-responsive renderer won't block us from 101 // as a watchdog, to ensure that a non-responsive renderer won't block us from
101 // making the callback. 102 // making the callback.
102 BrowserThread::PostDelayedTask( 103 BrowserThread::PostDelayedTask(
103 BrowserThread::UI, FROM_HERE, 104 BrowserThread::UI, FROM_HERE,
104 NewRunnableMethod( 105 base::Bind(
106 &HistogramSynchronizer::ForceHistogramSynchronizationDoneCallback,
105 current_synchronizer, 107 current_synchronizer,
106 &HistogramSynchronizer::ForceHistogramSynchronizationDoneCallback,
107 sequence_number), 108 sequence_number),
108 wait_time); 109 wait_time);
109 } 110 }
110 111
111 // static 112 // static
112 void HistogramSynchronizer::DeserializeHistogramList( 113 void HistogramSynchronizer::DeserializeHistogramList(
113 int sequence_number, 114 int sequence_number,
114 const std::vector<std::string>& histograms) { 115 const std::vector<std::string>& histograms) {
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
116 for (std::vector<std::string>::const_iterator it = histograms.begin(); 117 for (std::vector<std::string>::const_iterator it = histograms.begin();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 async_renderers_pending_ = renderer_count; 253 async_renderers_pending_ = renderer_count;
253 } else if (requester == SYNCHRONOUS_HISTOGRAMS) { 254 } else if (requester == SYNCHRONOUS_HISTOGRAMS) {
254 synchronous_sequence_number_ = last_used_sequence_number_; 255 synchronous_sequence_number_ = last_used_sequence_number_;
255 synchronous_renderers_pending_ = renderer_count; 256 synchronous_renderers_pending_ = renderer_count;
256 } 257 }
257 return last_used_sequence_number_; 258 return last_used_sequence_number_;
258 } 259 }
259 260
260 // static 261 // static
261 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL; 262 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL;
OLDNEW
« no previous file with comments | « chrome/browser/metrics/field_trial_synchronizer.cc ('k') | chrome/browser/metrics/metrics_reporting_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698