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

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

Issue 1149383004: [3/5 chromium] Shows the clients which are controlled by ServiceWorker in DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated nhiroki's comment Created 5 years, 6 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: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index ff185072741e0c3924c982e8da48573ee9a068c4..3d763d3c0dbcfc2c25f8ca1b8d623fc61b3d7f21 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -538,6 +538,14 @@ ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() {
running_status(), status(), script_url(), registration_id(), version_id(),
embedded_worker()->process_id(), embedded_worker()->thread_id(),
embedded_worker()->worker_devtools_agent_route_id());
+ for (auto& controllee : controllee_map_) {
+ const ServiceWorkerProviderHost* const host = controllee.second;
nhiroki 2015/06/12 09:07:47 "const T* const foo" seems not common among our co
horo 2015/06/12 09:23:47 Done.
+ info.clients.insert(
+ std::pair<std::string, ServiceWorkerVersionInfo::ClientInfo>(
+ host->client_uuid(),
+ ServiceWorkerVersionInfo::ClientInfo(
+ host->process_id(), host->route_id(), host->provider_type())));
+ }
if (!main_script_http_info_)
return info;
info.script_response_time = main_script_http_info_->response_time;
@@ -936,6 +944,8 @@ void ServiceWorkerVersion::AddControllee(
controllee_map_[uuid] = provider_host;
// Keep the worker alive a bit longer right after a new controllee is added.
RestartTick(&idle_time_);
+ FOR_EACH_OBSERVER(Listener, listeners_,
+ OnControlleeAdded(this, provider_host));
}
void ServiceWorkerVersion::RemoveControllee(
@@ -943,6 +953,8 @@ void ServiceWorkerVersion::RemoveControllee(
const std::string& uuid = provider_host->client_uuid();
DCHECK(ContainsKey(controllee_map_, uuid));
controllee_map_.erase(uuid);
+ FOR_EACH_OBSERVER(Listener, listeners_,
+ OnControlleeRemoved(this, provider_host));
if (HasControllee())
return;
FOR_EACH_OBSERVER(Listener, listeners_, OnNoControllees(this));

Powered by Google App Engine
This is Rietveld 408576698