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

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

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: Fix the way Task Manager accounts for network usage by plug-ins. 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.h
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.h b/chrome/browser/task_manager/task_manager_resource_providers.h
index c1c0671110a599b82801717c2d4154b28e8b05a3..11264fc5b117551dc186c830de2c85efff76db60 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.h
+++ b/chrome/browser/task_manager/task_manager_resource_providers.h
@@ -99,7 +99,7 @@ class TaskManagerTabContentsResourceProvider
public:
explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager);
- virtual TaskManager::Resource* GetResource(int origin_pid,
+ virtual TaskManager::Resource* GetResource(int origin_child_id,
int render_process_host_id,
int routing_id);
virtual void StartUpdating();
@@ -168,7 +168,7 @@ class TaskManagerBackgroundContentsResourceProvider
explicit TaskManagerBackgroundContentsResourceProvider(
TaskManager* task_manager);
- virtual TaskManager::Resource* GetResource(int origin_pid,
+ virtual TaskManager::Resource* GetResource(int origin_child_id,
int render_process_host_id,
int routing_id);
virtual void StartUpdating();
@@ -218,12 +218,11 @@ class TaskManagerChildProcessResource : public TaskManager::Resource {
virtual bool SupportNetworkUsage() const;
virtual void SetSupportNetworkUsage();
- // Returns the pid of the child process.
- int process_id() const { return pid_; }
+ // Return the child process' unique child ID for use by GetResource()
+ int id() { return child_process_.id(); }
private:
ChildProcessInfo child_process_;
- int pid_;
mutable std::wstring title_;
bool network_usage_support_;
@@ -241,7 +240,7 @@ class TaskManagerChildProcessResourceProvider
public:
explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager);
- virtual TaskManager::Resource* GetResource(int origin_pid,
+ virtual TaskManager::Resource* GetResource(int origin_child_id,
int render_process_host_id,
int routing_id);
virtual void StartUpdating();
@@ -281,7 +280,7 @@ class TaskManagerChildProcessResourceProvider
// Maps the pids to the resources (used for quick access to the resource on
// byte read notifications).
- std::map<int, TaskManagerChildProcessResource*> pid_to_resources_;
+ std::map<int, TaskManagerChildProcessResource*> child_id_to_resources_;
// A scoped container for notification registries.
NotificationRegistrar registrar_;
@@ -303,12 +302,10 @@ class TaskManagerExtensionProcessResource : public TaskManager::Resource {
virtual void SetSupportNetworkUsage();
virtual const Extension* GetExtension() const;
- // Returns the pid of the extension process.
- int process_id() const { return pid_; }
-
// Returns true if the associated extension has a background page.
virtual bool IsBackground() const;
+ int id() { return id_; }
private:
// The icon painted for the extension process.
static SkBitmap* default_icon_;
@@ -317,8 +314,8 @@ class TaskManagerExtensionProcessResource : public TaskManager::Resource {
// Cached data about the extension.
base::ProcessHandle process_handle_;
- int pid_;
std::wstring title_;
+ int id_;
DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource);
};
@@ -330,7 +327,7 @@ class TaskManagerExtensionProcessResourceProvider
explicit TaskManagerExtensionProcessResourceProvider(
TaskManager* task_manager);
- virtual TaskManager::Resource* GetResource(int origin_pid,
+ virtual TaskManager::Resource* GetResource(int origin_child_id,
int render_process_host_id,
int routing_id);
virtual void StartUpdating();
@@ -354,7 +351,7 @@ class TaskManagerExtensionProcessResourceProvider
// Maps the pids to the resources (used for quick access to the resource on
// byte read notifications).
- std::map<int, TaskManagerExtensionProcessResource*> pid_to_resources_;
+ std::map<int, TaskManagerExtensionProcessResource*> child_id_to_resources_;
// A scoped container for notification registries.
NotificationRegistrar registrar_;
@@ -399,7 +396,7 @@ class TaskManagerNotificationResourceProvider
explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager);
// TaskManager::ResourceProvider interface
- virtual TaskManager::Resource* GetResource(int origin_pid,
+ virtual TaskManager::Resource* GetResource(int origin_child_id,
int render_process_host_id,
int routing_id);
virtual void StartUpdating();
@@ -446,12 +443,8 @@ class TaskManagerBrowserProcessResource : public TaskManager::Resource {
virtual bool ReportsSqliteMemoryUsed() const;
virtual size_t SqliteMemoryUsedBytes() const;
- // Returns the pid of the browser process.
- int process_id() const { return pid_; }
-
private:
base::ProcessHandle process_;
- int pid_;
mutable std::wstring title_;
static SkBitmap* default_icon_;
@@ -465,7 +458,7 @@ class TaskManagerBrowserProcessResourceProvider
explicit TaskManagerBrowserProcessResourceProvider(
TaskManager* task_manager);
- virtual TaskManager::Resource* GetResource(int origin_pid,
+ virtual TaskManager::Resource* GetResource(int origin_child_id,
int render_process_host_id,
int routing_id);
virtual void StartUpdating();

Powered by Google App Engine
This is Rietveld 408576698