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

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 dcheng'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..ac85007685db8d1b60780100dc8b0ca97aabd4cd 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -538,6 +538,13 @@ 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 (const auto& controllee : controllee_map_) {
+ const ServiceWorkerProviderHost* host = controllee.second;
+ info.clients.insert(std::make_pair(
+ 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 +943,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 +952,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