| Index: content/browser/profiler_controller_impl.cc
|
| diff --git a/content/browser/profiler_controller_impl.cc b/content/browser/profiler_controller_impl.cc
|
| index b3e40e8a64195a5f5bfa39f51f0f6ee279c5f3ba..a850cfd92c3e696eb53240217f1d35b49b0c0310 100644
|
| --- a/content/browser/profiler_controller_impl.cc
|
| +++ b/content/browser/profiler_controller_impl.cc
|
| @@ -5,14 +5,13 @@
|
| #include "content/browser/profiler_controller_impl.h"
|
|
|
| #include "base/bind.h"
|
| -#include "base/values.h"
|
| +#include "base/tracked_objects.h"
|
| #include "content/common/child_process_messages.h"
|
| #include "content/public/browser/browser_child_process_host_iterator.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/child_process_data.h"
|
| #include "content/public/browser/profiler_subscriber.h"
|
| #include "content/public/browser/render_process_host.h"
|
| -#include "content/public/common/process_type.h"
|
|
|
| using content::BrowserChildProcessHostIterator;
|
| using content::BrowserThread;
|
| @@ -43,20 +42,24 @@ void ProfilerControllerImpl::OnPendingProcesses(int sequence_number,
|
|
|
| void ProfilerControllerImpl::OnProfilerDataCollected(
|
| int sequence_number,
|
| - base::DictionaryValue* profiler_data) {
|
| + const tracked_objects::ProcessDataSnapshot& profiler_data,
|
| + content::ProcessType process_type) {
|
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| base::Bind(&ProfilerControllerImpl::OnProfilerDataCollected,
|
| base::Unretained(this),
|
| sequence_number,
|
| - profiler_data));
|
| + profiler_data,
|
| + process_type));
|
| return;
|
| }
|
|
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - if (subscriber_)
|
| - subscriber_->OnProfilerDataCollected(sequence_number, profiler_data);
|
| + if (subscriber_) {
|
| + subscriber_->OnProfilerDataCollected(sequence_number, profiler_data,
|
| + process_type);
|
| + }
|
| }
|
|
|
| void ProfilerControllerImpl::Register(ProfilerSubscriber* subscriber) {
|
| @@ -65,9 +68,9 @@ void ProfilerControllerImpl::Register(ProfilerSubscriber* subscriber) {
|
| subscriber_ = subscriber;
|
| }
|
|
|
| -void ProfilerControllerImpl::Unregister(ProfilerSubscriber* subscriber) {
|
| - if (subscriber == subscriber_)
|
| - subscriber_ = NULL;
|
| +void ProfilerControllerImpl::Unregister(const ProfilerSubscriber* subscriber) {
|
| + DCHECK_EQ(subscriber_, subscriber);
|
| + subscriber_ = NULL;
|
| }
|
|
|
| void ProfilerControllerImpl::GetProfilerDataFromChildProcesses(
|
| @@ -76,13 +79,9 @@ void ProfilerControllerImpl::GetProfilerDataFromChildProcesses(
|
|
|
| int pending_processes = 0;
|
| for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
|
| - const std::string process_type =
|
| - content::GetProcessTypeNameInEnglish(iter.GetData().type);
|
| ++pending_processes;
|
| - if (!iter.Send(new ChildProcessMsg_GetChildProfilerData(
|
| - sequence_number, process_type))) {
|
| + if (!iter.Send(new ChildProcessMsg_GetChildProfilerData(sequence_number)))
|
| --pending_processes;
|
| - }
|
| }
|
|
|
| BrowserThread::PostTask(
|
| @@ -100,14 +99,11 @@ void ProfilerControllerImpl::GetProfilerData(int sequence_number) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| int pending_processes = 0;
|
| - const std::string render_process_type =
|
| - content::GetProcessTypeNameInEnglish(content::PROCESS_TYPE_RENDERER);
|
| -
|
| for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
|
| !it.IsAtEnd(); it.Advance()) {
|
| ++pending_processes;
|
| - if (!it.GetCurrentValue()->Send(new ChildProcessMsg_GetChildProfilerData(
|
| - sequence_number, render_process_type))) {
|
| + if (!it.GetCurrentValue()->Send(
|
| + new ChildProcessMsg_GetChildProfilerData(sequence_number))) {
|
| --pending_processes;
|
| }
|
| }
|
| @@ -121,29 +117,4 @@ void ProfilerControllerImpl::GetProfilerData(int sequence_number) {
|
| sequence_number));
|
| }
|
|
|
| -void ProfilerControllerImpl::SetProfilerStatusInChildProcesses(
|
| - tracked_objects::ThreadData::Status status) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| -
|
| - for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter)
|
| - iter.Send(new ChildProcessMsg_SetProfilerStatus(status));
|
| -}
|
| -
|
| -void ProfilerControllerImpl::SetProfilerStatus(
|
| - tracked_objects::ThreadData::Status status) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO,
|
| - FROM_HERE,
|
| - base::Bind(&ProfilerControllerImpl::SetProfilerStatusInChildProcesses,
|
| - base::Unretained(this),
|
| - status));
|
| -
|
| - for (content::RenderProcessHost::iterator it(
|
| - content::RenderProcessHost::AllHostsIterator());
|
| - !it.IsAtEnd(); it.Advance()) {
|
| - it.GetCurrentValue()->Send(new ChildProcessMsg_SetProfilerStatus(status));
|
| - }
|
| -}
|
| } // namespace content
|
|
|