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

Unified Diff: chrome/browser/task_manager/task_manager_resource_providers.cc

Issue 6328010: Fix Task Manager to correctly display network usage of plug-in processes. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Set origin PID consistently, and only set it for plugin requests. Created 9 years, 11 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
Index: chrome/browser/task_manager/task_manager_resource_providers.cc
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc
index 0a822365fa22eda109d00942ab8f030659854091..78b502ddae89c582d5f2ae109e1cec45684a84e9 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -234,23 +234,14 @@ TaskManager::Resource* TaskManagerTabContentsResourceProvider::GetResource(
int origin_pid,
int render_process_host_id,
int routing_id) {
-
TabContents* tab_contents =
tab_util::GetTabContentsByID(render_process_host_id, routing_id);
if (!tab_contents) // Not one of our resource.
return NULL;
- base::ProcessHandle process_handle =
- tab_contents->GetRenderProcessHost()->GetHandle();
- if (!process_handle) {
- // We should not be holding on to a dead tab (it should have been removed
- // through the NOTIFY_TAB_CONTENTS_DISCONNECTED notification.
- NOTREACHED();
- return NULL;
- }
-
- int pid = base::GetProcId(process_handle);
- if (pid != origin_pid)
+ // If an origin PID was specified then the request originated in a plugin
+ // working on the TabContent's behalf, so ignore it
jam 2011/02/03 22:58:07 I don't understand this line and below on 453. wh
+ if (origin_pid)
return NULL;
std::map<TabContents*, TaskManagerTabContentsResource*>::iterator
@@ -454,19 +445,14 @@ TaskManagerBackgroundContentsResourceProvider::GetResource(
int origin_pid,
int render_process_host_id,
int routing_id) {
-
BackgroundContents* contents = BackgroundContents::GetBackgroundContentsByID(
render_process_host_id, routing_id);
if (!contents) // This resource no longer exists.
return NULL;
- base::ProcessHandle process_handle =
- contents->render_view_host()->process()->GetHandle();
- if (!process_handle) // Process crashed.
- return NULL;
-
- int pid = base::GetProcId(process_handle);
- if (pid != origin_pid)
+ // If an origin PID was specified, the request is from a plugin, not the
+ // render view host process
+ if (origin_pid)
return NULL;
std::map<BackgroundContents*,
@@ -643,7 +629,7 @@ TaskManagerChildProcessResource::TaskManagerChildProcessResource(
network_usage_support_(false) {
// We cache the process id because it's not cheap to calculate, and it won't
// be available when we get the plugin disconnected notification.
- pid_ = child_proc.id();
+ pid_ = child_proc.process_id();
if (!default_icon_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN);
@@ -1223,8 +1209,8 @@ SkBitmap* TaskManagerBrowserProcessResource::default_icon_ = NULL;
TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource()
: title_() {
- pid_ = base::GetCurrentProcId();
- bool success = base::OpenPrivilegedProcessHandle(pid_, &process_);
+ int pid = base::GetCurrentProcId();
+ bool success = base::OpenPrivilegedProcessHandle(pid, &process_);
DCHECK(success);
#if defined(OS_WIN)
if (!default_icon_) {
@@ -1316,7 +1302,7 @@ TaskManager::Resource* TaskManagerBrowserProcessResourceProvider::GetResource(
int origin_pid,
int render_process_host_id,
int routing_id) {
- if (origin_pid != resource_.process_id()) {
+ if (origin_pid || render_process_host_id != -1) {
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698