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

Unified Diff: content/browser/profiler_controller_impl.cc

Issue 9702014: [UMA] Use proper C++ objects to serialize tracked_objects across process boundaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix yet another IWYU for chromeos/ (take 4) Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/profiler_controller_impl.h ('k') | content/browser/profiler_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/profiler_controller_impl.h ('k') | content/browser/profiler_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698