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

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

Issue 3660002: Rename ChromeThread to BrowserThread Part13: (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: Created 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/histogram.h" 7 #include "base/histogram.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/browser/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 HistogramSynchronizer* current_synchronizer = 91 HistogramSynchronizer* current_synchronizer =
92 HistogramSynchronizer::CurrentSynchronizer(); 92 HistogramSynchronizer::CurrentSynchronizer();
93 93
94 if (current_synchronizer == NULL) { 94 if (current_synchronizer == NULL) {
95 // System teardown is happening. 95 // System teardown is happening.
96 callback_thread->PostTask(FROM_HERE, callback_task); 96 callback_thread->PostTask(FROM_HERE, callback_task);
97 return; 97 return;
98 } 98 }
99 99
100 // callback_task_ member can only be accessed on IO thread. 100 // callback_task_ member can only be accessed on IO thread.
101 ChromeThread::PostTask( 101 BrowserThread::PostTask(
102 ChromeThread::IO, FROM_HERE, 102 BrowserThread::IO, FROM_HERE,
103 NewRunnableMethod( 103 NewRunnableMethod(
104 current_synchronizer, 104 current_synchronizer,
105 &HistogramSynchronizer::SetCallbackTaskToCallAfterGettingHistograms, 105 &HistogramSynchronizer::SetCallbackTaskToCallAfterGettingHistograms,
106 callback_thread, 106 callback_thread,
107 callback_task)); 107 callback_task));
108 108
109 // Tell all renderer processes to send their histograms. 109 // Tell all renderer processes to send their histograms.
110 int sequence_number = 110 int sequence_number =
111 current_synchronizer->GetNextAvaibleSequenceNumber(ASYNC_HISTOGRAMS); 111 current_synchronizer->GetNextAvaibleSequenceNumber(ASYNC_HISTOGRAMS);
112 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 112 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
113 !it.IsAtEnd(); it.Advance()) { 113 !it.IsAtEnd(); it.Advance()) {
114 it.GetCurrentValue()->Send( 114 it.GetCurrentValue()->Send(
115 new ViewMsg_GetRendererHistograms(sequence_number)); 115 new ViewMsg_GetRendererHistograms(sequence_number));
116 current_synchronizer->IncrementPendingRenderers(ASYNC_HISTOGRAMS); 116 current_synchronizer->IncrementPendingRenderers(ASYNC_HISTOGRAMS);
117 } 117 }
118 118
119 // Post a task that would be called after waiting for wait_time. 119 // Post a task that would be called after waiting for wait_time.
120 ChromeThread::PostDelayedTask( 120 BrowserThread::PostDelayedTask(
121 ChromeThread::IO, FROM_HERE, 121 BrowserThread::IO, FROM_HERE,
122 NewRunnableMethod( 122 NewRunnableMethod(
123 current_synchronizer, 123 current_synchronizer,
124 &HistogramSynchronizer::ForceHistogramSynchronizationDoneCallback, 124 &HistogramSynchronizer::ForceHistogramSynchronizationDoneCallback,
125 sequence_number), 125 sequence_number),
126 wait_time); 126 wait_time);
127 } 127 }
128 128
129 // static 129 // static
130 void HistogramSynchronizer::DeserializeHistogramList( 130 void HistogramSynchronizer::DeserializeHistogramList(
131 int sequence_number, 131 int sequence_number,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 bool HistogramSynchronizer::IsOnIoThread() { 270 bool HistogramSynchronizer::IsOnIoThread() {
271 if (io_message_loop_ == NULL) { 271 if (io_message_loop_ == NULL) {
272 io_message_loop_ = MessageLoop::current(); 272 io_message_loop_ = MessageLoop::current();
273 } 273 }
274 return (MessageLoop::current() == io_message_loop_); 274 return (MessageLoop::current() == io_message_loop_);
275 } 275 }
276 276
277 // static 277 // static
278 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL; 278 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL;
OLDNEW
« no previous file with comments | « chrome/browser/file_system/file_system_host_context_unittest.cc ('k') | chrome/browser/policy/config_dir_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698