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

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: Redo patch set for changes to trunk. 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
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.h ('k') | chrome/common/child_process_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a1a6a1822098ab171a6964ef039ef79185449a6f..2197b338b44f4f825164466b9a59f80924a05720 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.
+ if (origin_pid)
return NULL;
std::map<TabContents*, TaskManagerTabContentsResource*>::iterator
@@ -453,19 +444,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*,
@@ -642,7 +628,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.pid();
if (!default_icon_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN);
@@ -1220,8 +1206,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_) {
@@ -1312,7 +1298,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;
}
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.h ('k') | chrome/common/child_process_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698