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

Side by Side Diff: content/browser/profiler_controller_impl.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
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/profiler_controller_impl.h" 5 #include "content/browser/profiler_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/process/process_handle.h"
9 #include "base/tracked_objects.h" 9 #include "base/tracked_objects.h"
10 #include "content/common/child_process_messages.h" 10 #include "content/common/child_process_messages.h"
11 #include "content/public/browser/browser_child_process_host_iterator.h" 11 #include "content/public/browser/browser_child_process_host_iterator.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/child_process_data.h" 13 #include "content/public/browser/child_process_data.h"
14 #include "content/public/browser/profiler_subscriber.h" 14 #include "content/public/browser/profiler_subscriber.h"
15 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
16 #include "content/public/common/content_switches.h"
17 16
18 namespace content { 17 namespace content {
19 18
20 ProfilerController* ProfilerController::GetInstance() { 19 ProfilerController* ProfilerController::GetInstance() {
21 return ProfilerControllerImpl::GetInstance(); 20 return ProfilerControllerImpl::GetInstance();
22 } 21 }
23 22
24 ProfilerControllerImpl* ProfilerControllerImpl::GetInstance() { 23 ProfilerControllerImpl* ProfilerControllerImpl::GetInstance() {
25 return Singleton<ProfilerControllerImpl>::get(); 24 return Singleton<ProfilerControllerImpl>::get();
26 } 25 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 68
70 void ProfilerControllerImpl::Unregister(const ProfilerSubscriber* subscriber) { 69 void ProfilerControllerImpl::Unregister(const ProfilerSubscriber* subscriber) {
71 DCHECK_EQ(subscriber_, subscriber); 70 DCHECK_EQ(subscriber_, subscriber);
72 subscriber_ = NULL; 71 subscriber_ = NULL;
73 } 72 }
74 73
75 void ProfilerControllerImpl::GetProfilerDataFromChildProcesses( 74 void ProfilerControllerImpl::GetProfilerDataFromChildProcesses(
76 int sequence_number) { 75 int sequence_number) {
77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
78 77
78 const base::ProcessId current_proc_id = base::GetCurrentProcId();
79 int pending_processes = 0; 79 int pending_processes = 0;
80 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { 80 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
81 // Skips requesting profiler data from the "GPU Process" if we are using in 81 // In some cases, the child process may be the same as the current process -
82 // process GPU. Those stats should be in the Browser-process's GPU thread. 82 // for example the GPU process may be the same as the browser process. Don't
83 if (iter.GetData().process_type == PROCESS_TYPE_GPU && 83 // ask it for profiler data in that case.
84 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU)) { 84 if (base::GetProcId(iter.GetData().handle) == current_proc_id)
85 continue; 85 continue;
86 }
87 86
88 ++pending_processes; 87 ++pending_processes;
89 if (!iter.Send(new ChildProcessMsg_GetChildProfilerData(sequence_number))) 88 if (!iter.Send(new ChildProcessMsg_GetChildProfilerData(sequence_number)))
90 --pending_processes; 89 --pending_processes;
91 } 90 }
92 91
93 BrowserThread::PostTask( 92 BrowserThread::PostTask(
94 BrowserThread::UI, 93 BrowserThread::UI,
95 FROM_HERE, 94 FROM_HERE,
96 base::Bind( 95 base::Bind(
(...skipping 20 matching lines...) Expand all
117 116
118 BrowserThread::PostTask( 117 BrowserThread::PostTask(
119 BrowserThread::IO, 118 BrowserThread::IO,
120 FROM_HERE, 119 FROM_HERE,
121 base::Bind(&ProfilerControllerImpl::GetProfilerDataFromChildProcesses, 120 base::Bind(&ProfilerControllerImpl::GetProfilerDataFromChildProcesses,
122 base::Unretained(this), 121 base::Unretained(this),
123 sequence_number)); 122 sequence_number));
124 } 123 }
125 124
126 } // namespace content 125 } // namespace content
OLDNEW
« content/browser/gpu/gpu_process_host.cc ('K') | « content/browser/histogram_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698