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

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

Issue 9959101: Exposing the child process unique ID through the task manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved the comment on the new function in TaskManagerModel. Created 8 years, 9 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 6c974c84370e54a237c47ad74bd26b38e5dcfac0..2ca81576e9a5cbb21ab9696873bbfb870bcba5b5 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -115,6 +115,7 @@ TaskManagerRendererResource::TaskManagerRendererResource(
// We cache the process and pid as when a Tab/BackgroundContents is closed the
// process reference becomes NULL and the TaskManager still needs it.
pid_ = base::GetProcId(process_);
+ unique_process_id_ = render_view_host_->GetProcess()->GetID();
memset(&stats_, 0, sizeof(stats_));
}
@@ -176,6 +177,10 @@ base::ProcessHandle TaskManagerRendererResource::GetProcess() const {
return process_;
}
+int TaskManagerRendererResource::GetUniqueChildProcessId() const {
+ return unique_process_id_;
+}
+
TaskManager::Resource::Type TaskManagerRendererResource::GetType() const {
return RENDERER;
}
@@ -796,10 +801,12 @@ SkBitmap* TaskManagerChildProcessResource::default_icon_ = NULL;
TaskManagerChildProcessResource::TaskManagerChildProcessResource(
content::ProcessType type,
const string16& name,
- base::ProcessHandle handle)
+ base::ProcessHandle handle,
+ int unique_process_id)
: type_(type),
name_(name),
handle_(handle),
+ unique_process_id_(unique_process_id),
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.
@@ -834,6 +841,10 @@ base::ProcessHandle TaskManagerChildProcessResource::GetProcess() const {
return handle_;
}
+int TaskManagerChildProcessResource::GetUniqueChildProcessId() const {
+ return unique_process_id_;
+}
+
TaskManager::Resource::Type TaskManagerChildProcessResource::GetType() const {
// Translate types to TaskManager::ResourceType, since ChildProcessData's type
// is not available for all TaskManager resources.
@@ -1067,7 +1078,8 @@ void TaskManagerChildProcessResourceProvider::AddToTaskManager(
new TaskManagerChildProcessResource(
child_process_data.type,
child_process_data.name,
- child_process_data.handle);
+ child_process_data.handle,
+ child_process_data.id);
resources_[child_process_data.handle] = resource;
pid_to_resources_[resource->process_id()] = resource;
task_manager_->AddResource(resource);
@@ -1112,6 +1124,7 @@ TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource(
default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN);
}
process_handle_ = extension_host_->render_process_host()->GetHandle();
+ unique_process_id_ = extension_host_->render_process_host()->GetID();
pid_ = base::GetProcId(process_handle_);
string16 extension_name = UTF8ToUTF16(GetExtension()->name());
DCHECK(!extension_name.empty());
@@ -1147,6 +1160,10 @@ base::ProcessHandle TaskManagerExtensionProcessResource::GetProcess() const {
return process_handle_;
}
+int TaskManagerExtensionProcessResource::GetUniqueChildProcessId() const {
+ return unique_process_id_;
+}
+
TaskManager::Resource::Type
TaskManagerExtensionProcessResource::GetType() const {
return EXTENSION;
@@ -1379,6 +1396,10 @@ base::ProcessHandle TaskManagerBrowserProcessResource::GetProcess() const {
return base::GetCurrentProcessHandle(); // process_;
}
+int TaskManagerBrowserProcessResource::GetUniqueChildProcessId() const {
+ return 0;
+}
+
TaskManager::Resource::Type TaskManagerBrowserProcessResource::GetType() const {
return BROWSER;
}

Powered by Google App Engine
This is Rietveld 408576698