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

Side by Side Diff: content/browser/histogram_controller.cc

Issue 328823002: Don't fetch histograms from the same process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/profiler_controller_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/histogram_controller.h" 5 #include "content/browser/histogram_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process/process_handle.h"
9 #include "content/browser/histogram_subscriber.h" 10 #include "content/browser/histogram_subscriber.h"
10 #include "content/common/child_process_messages.h" 11 #include "content/common/child_process_messages.h"
11 #include "content/public/browser/browser_child_process_host_iterator.h" 12 #include "content/public/browser/browser_child_process_host_iterator.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/child_process_data.h" 14 #include "content/public/browser/child_process_data.h"
14 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
15 #include "content/public/common/process_type.h" 16 #include "content/public/common/process_type.h"
16 17
17 namespace content { 18 namespace content {
18 19
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DCHECK_EQ(subscriber_, subscriber); 66 DCHECK_EQ(subscriber_, subscriber);
66 subscriber_ = NULL; 67 subscriber_ = NULL;
67 } 68 }
68 69
69 void HistogramController::GetHistogramDataFromChildProcesses( 70 void HistogramController::GetHistogramDataFromChildProcesses(
70 int sequence_number) { 71 int sequence_number) {
71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
72 73
73 int pending_processes = 0; 74 int pending_processes = 0;
74 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { 75 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
75 int type = iter.GetData().process_type; 76 const ChildProcessData& data = iter.GetData();
77 int type = data.process_type;
76 if (type != PROCESS_TYPE_PLUGIN && 78 if (type != PROCESS_TYPE_PLUGIN &&
77 type != PROCESS_TYPE_GPU && 79 type != PROCESS_TYPE_GPU &&
78 type != PROCESS_TYPE_PPAPI_PLUGIN && 80 type != PROCESS_TYPE_PPAPI_PLUGIN &&
79 type != PROCESS_TYPE_PPAPI_BROKER) { 81 type != PROCESS_TYPE_PPAPI_BROKER) {
80 continue; 82 continue;
81 } 83 }
82 84
85 // In some cases, there may be no child process of the given type (for
86 // example, the GPU process may not exist and there may instead just be a
87 // GPU thread in the browser process). If that's the case, then the process
88 // handle will be base::kNullProcessHandle and we shouldn't ask it for data.
89 if (data.handle == base::kNullProcessHandle)
90 continue;
91
83 ++pending_processes; 92 ++pending_processes;
84 if (!iter.Send(new ChildProcessMsg_GetChildHistogramData(sequence_number))) 93 if (!iter.Send(new ChildProcessMsg_GetChildHistogramData(sequence_number)))
85 --pending_processes; 94 --pending_processes;
86 } 95 }
87 96
88 BrowserThread::PostTask( 97 BrowserThread::PostTask(
89 BrowserThread::UI, 98 BrowserThread::UI,
90 FROM_HERE, 99 FROM_HERE,
91 base::Bind( 100 base::Bind(
92 &HistogramController::OnPendingProcesses, 101 &HistogramController::OnPendingProcesses,
(...skipping 19 matching lines...) Expand all
112 121
113 BrowserThread::PostTask( 122 BrowserThread::PostTask(
114 BrowserThread::IO, 123 BrowserThread::IO,
115 FROM_HERE, 124 FROM_HERE,
116 base::Bind(&HistogramController::GetHistogramDataFromChildProcesses, 125 base::Bind(&HistogramController::GetHistogramDataFromChildProcesses,
117 base::Unretained(this), 126 base::Unretained(this),
118 sequence_number)); 127 sequence_number));
119 } 128 }
120 129
121 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/profiler_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698