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

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: rebase 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..af2820b530c8d969d612c4cbaa0292c856e21226 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_) {
dcheng 2015/06/17 02:57:30 const auto&?
horo 2015/06/17 07:37:05 Done.
+ const ServiceWorkerProviderHost* host = controllee.second;
+ info.clients.insert(
+ std::pair<std::string, ServiceWorkerVersionInfo::ClientInfo>(
dcheng 2015/06/17 02:57:30 std::make_pair
horo 2015/06/17 07:37:05 Done.
+ 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