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

Unified Diff: content/browser/service_worker/service_worker_internals_ui.cc

Issue 1645453002: ServiceWorker: Show real process IDs in chrome://serviceworker-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_internals_ui.cc
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc
index c59d41f67f8c0a45a9ab81ea73f32fae1560142a..c443f2e66966daa9738395a40c175f49b26e0a47 100644
--- a/content/browser/service_worker/service_worker_internals_ui.cc
+++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -22,10 +22,12 @@
#include "content/grit/content_resources.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "content/public/common/child_process_host.h"
#include "content/public/common/url_constants.h"
using base::DictionaryValue;
@@ -89,6 +91,20 @@ void CallServiceWorkerVersionMethodWithVersionID(
(*version.get().*method)(callback);
}
+base::ProcessId GetRealProcessId(int process_host_id) {
+ if (process_host_id == ChildProcessHost::kInvalidUniqueID)
+ return base::kNullProcessId;
+
+ RenderProcessHost* rph = RenderProcessHost::FromID(process_host_id);
+ if (!rph)
+ return base::kNullProcessId;
+
+ base::ProcessHandle handle = rph->GetHandle();
+ if (handle == base::kNullProcessHandle)
+ return base::kNullProcessId;
+ return base::Process(handle).Pid();
+}
+
void UpdateVersionInfo(const ServiceWorkerVersionInfo& version,
DictionaryValue* info) {
switch (version.running_status) {
@@ -128,7 +144,8 @@ void UpdateVersionInfo(const ServiceWorkerVersionInfo& version,
}
info->SetString("script_url", version.script_url.spec());
info->SetString("version_id", base::Int64ToString(version.version_id));
- info->SetInteger("process_id", version.process_id);
+ info->SetInteger("process_id",
+ static_cast<int>(GetRealProcessId(version.process_id)));
info->SetInteger("thread_id", version.thread_id);
info->SetInteger("devtools_agent_route_id", version.devtools_agent_route_id);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698