summaryrefslogtreecommitdiff
path: root/chromium/content/browser/profiler_controller_impl.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-06-18 14:10:49 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-06-18 13:53:24 +0000
commit813fbf95af77a531c57a8c497345ad2c61d475b3 (patch)
tree821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/content/browser/profiler_controller_impl.cc
parentaf6588f8d723931a298c995fa97259bb7f7deb55 (diff)
downloadqtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/content/browser/profiler_controller_impl.cc')
-rw-r--r--chromium/content/browser/profiler_controller_impl.cc73
1 files changed, 58 insertions, 15 deletions
diff --git a/chromium/content/browser/profiler_controller_impl.cc b/chromium/content/browser/profiler_controller_impl.cc
index 27c95ed9138..7427d15f686 100644
--- a/chromium/content/browser/profiler_controller_impl.cc
+++ b/chromium/content/browser/profiler_controller_impl.cc
@@ -33,7 +33,7 @@ ProfilerControllerImpl::~ProfilerControllerImpl() {
void ProfilerControllerImpl::OnPendingProcesses(int sequence_number,
int pending_processes,
bool end) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (subscriber_)
subscriber_->OnPendingProcesses(sequence_number, pending_processes, end);
}
@@ -41,7 +41,7 @@ void ProfilerControllerImpl::OnPendingProcesses(int sequence_number,
void ProfilerControllerImpl::OnProfilerDataCollected(
int sequence_number,
const tracked_objects::ProcessDataSnapshot& profiler_data,
- int process_type) {
+ content::ProcessType process_type) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -53,7 +53,7 @@ void ProfilerControllerImpl::OnProfilerDataCollected(
return;
}
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (subscriber_) {
subscriber_->OnProfilerDataCollected(sequence_number, profiler_data,
process_type);
@@ -61,7 +61,7 @@ void ProfilerControllerImpl::OnProfilerDataCollected(
}
void ProfilerControllerImpl::Register(ProfilerSubscriber* subscriber) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!subscriber_);
subscriber_ = subscriber;
}
@@ -72,8 +72,9 @@ void ProfilerControllerImpl::Unregister(const ProfilerSubscriber* subscriber) {
}
void ProfilerControllerImpl::GetProfilerDataFromChildProcesses(
- int sequence_number) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ int sequence_number,
+ int current_profiling_phase) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
int pending_processes = 0;
for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
@@ -85,8 +86,10 @@ void ProfilerControllerImpl::GetProfilerDataFromChildProcesses(
continue;
++pending_processes;
- if (!iter.Send(new ChildProcessMsg_GetChildProfilerData(sequence_number)))
+ if (!iter.Send(new ChildProcessMsg_GetChildProfilerData(
+ sequence_number, current_profiling_phase))) {
--pending_processes;
+ }
}
BrowserThread::PostTask(
@@ -100,26 +103,66 @@ void ProfilerControllerImpl::GetProfilerDataFromChildProcesses(
true));
}
-void ProfilerControllerImpl::GetProfilerData(int sequence_number) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+// static
+void ProfilerControllerImpl::NotifyChildProcessesOfProfilingPhaseCompletion(
+ int profiling_phase) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
+ // In some cases, there may be no child process of the given type (for
+ // example, the GPU process may not exist and there may instead just be a
+ // GPU thread in the browser process). If that's the case, then the process
+ // handle will be base::kNullProcessHandle and we shouldn't send it a
+ // message.
+ if (iter.GetData().handle == base::kNullProcessHandle)
+ continue;
+
+ iter.Send(new ChildProcessMsg_ProfilingPhaseCompleted(profiling_phase));
+ }
+}
+
+void ProfilerControllerImpl::GetProfilerData(int sequence_number,
+ int current_profiling_phase) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ // Iterates through renderers in UI thread, and through other child processes
+ // in IO thread, and send them GetChildProfilerData message. Renderers have to
+ // be contacted from UI thread, and other processes - from IO thread.
int pending_processes = 0;
for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
!it.IsAtEnd(); it.Advance()) {
++pending_processes;
- if (!it.GetCurrentValue()->Send(
- new ChildProcessMsg_GetChildProfilerData(sequence_number))) {
+ if (!it.GetCurrentValue()->Send(new ChildProcessMsg_GetChildProfilerData(
+ sequence_number, current_profiling_phase))) {
--pending_processes;
}
}
OnPendingProcesses(sequence_number, pending_processes, false);
BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
+ BrowserThread::IO, FROM_HERE,
base::Bind(&ProfilerControllerImpl::GetProfilerDataFromChildProcesses,
- base::Unretained(this),
- sequence_number));
+ base::Unretained(this), sequence_number,
+ current_profiling_phase));
+}
+
+void ProfilerControllerImpl::OnProfilingPhaseCompleted(int profiling_phase) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ // Iterates through renderers in UI thread, and through other child processes
+ // in IO thread, and send them OnProfilingPhase message. Renderers have to be
+ // contacted from UI thread, and other processes - from IO thread.
+ for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
+ !it.IsAtEnd(); it.Advance()) {
+ it.GetCurrentValue()->Send(
+ new ChildProcessMsg_ProfilingPhaseCompleted(profiling_phase));
+ }
+
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&ProfilerControllerImpl::
+ NotifyChildProcessesOfProfilingPhaseCompletion,
+ profiling_phase));
}
} // namespace content