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

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

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (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/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
11 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
12 #include "content/browser/renderer_host/render_process_host.h"
13 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h"
14 14
15 using base::Time; 15 using base::Time;
16 using base::TimeDelta; 16 using base::TimeDelta;
17 using base::TimeTicks; 17 using base::TimeTicks;
18 using content::BrowserThread; 18 using content::BrowserThread;
19 19
20 // Negative numbers are never used as sequence numbers. We explicitly pick a 20 // Negative numbers are never used as sequence numbers. We explicitly pick a
21 // negative number that is "so negative" that even when we add one (as is done 21 // negative number that is "so negative" that even when we add one (as is done
22 // when we generated the next sequence number) that it will still be negative. 22 // when we generated the next sequence number) that it will still be negative.
23 // We have code that handles wrapping around on an overflow into negative 23 // We have code that handles wrapping around on an overflow into negative
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 current_synchronizer->DecrementPendingRenderers(sequence_number); 127 current_synchronizer->DecrementPendingRenderers(sequence_number);
128 } 128 }
129 129
130 int HistogramSynchronizer::NotifyAllRenderers( 130 int HistogramSynchronizer::NotifyAllRenderers(
131 RendererHistogramRequester requester) { 131 RendererHistogramRequester requester) {
132 // To iterate over RenderProcessHosts, or to send messages to the hosts, we 132 // To iterate over RenderProcessHosts, or to send messages to the hosts, we
133 // need to be on the UI thread. 133 // need to be on the UI thread.
134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
135 135
136 int notification_count = 0; 136 int notification_count = 0;
137 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 137 for (content::RenderProcessHost::iterator it(
138 content::RenderProcessHost::AllHostsIterator());
138 !it.IsAtEnd(); it.Advance()) 139 !it.IsAtEnd(); it.Advance())
139 ++notification_count; 140 ++notification_count;
140 141
141 int sequence_number = GetNextAvailableSequenceNumber(requester, 142 int sequence_number = GetNextAvailableSequenceNumber(requester,
142 notification_count); 143 notification_count);
143 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 144 for (content::RenderProcessHost::iterator it(
145 content::RenderProcessHost::AllHostsIterator());
144 !it.IsAtEnd(); it.Advance()) { 146 !it.IsAtEnd(); it.Advance()) {
145 if (!it.GetCurrentValue()->Send( 147 if (!it.GetCurrentValue()->Send(
146 new ChromeViewMsg_GetRendererHistograms(sequence_number))) 148 new ChromeViewMsg_GetRendererHistograms(sequence_number)))
147 DecrementPendingRenderers(sequence_number); 149 DecrementPendingRenderers(sequence_number);
148 } 150 }
149 151
150 return sequence_number; 152 return sequence_number;
151 } 153 }
152 154
153 void HistogramSynchronizer::DecrementPendingRenderers(int sequence_number) { 155 void HistogramSynchronizer::DecrementPendingRenderers(int sequence_number) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 async_renderers_pending_ = renderer_count; 252 async_renderers_pending_ = renderer_count;
251 } else if (requester == SYNCHRONOUS_HISTOGRAMS) { 253 } else if (requester == SYNCHRONOUS_HISTOGRAMS) {
252 synchronous_sequence_number_ = last_used_sequence_number_; 254 synchronous_sequence_number_ = last_used_sequence_number_;
253 synchronous_renderers_pending_ = renderer_count; 255 synchronous_renderers_pending_ = renderer_count;
254 } 256 }
255 return last_used_sequence_number_; 257 return last_used_sequence_number_;
256 } 258 }
257 259
258 // static 260 // static
259 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL; 261 HistogramSynchronizer* HistogramSynchronizer::histogram_synchronizer_ = NULL;
OLDNEW
« no previous file with comments | « chrome/browser/metrics/field_trial_synchronizer.cc ('k') | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698