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

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

Issue 2706923003: Add UMA for how long service workers run for. (Closed)
Patch Set: constexpr Created 3 years, 10 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_context_core.cc
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc
index a0bbc665b4cbcdbdb437d04c5d49de1439778830..1bf42f4b5258d488947a7da324c161834e8a1a90 100644
--- a/content/browser/service_worker/service_worker_context_core.cc
+++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -750,6 +750,18 @@ int ServiceWorkerContextCore::GetVersionFailureCount(int64_t version_id) {
void ServiceWorkerContextCore::OnRunningStateChanged(
ServiceWorkerVersion* version) {
+ switch (version->running_status()) {
+ case EmbeddedWorkerStatus::STOPPED:
+ lifetime_tracker_.StopTiming(version->version_id());
+ break;
+ case EmbeddedWorkerStatus::RUNNING:
+ lifetime_tracker_.StartTiming(version->version_id());
+ break;
+ case EmbeddedWorkerStatus::STARTING:
+ case EmbeddedWorkerStatus::STOPPING:
+ break;
+ }
+
if (!observer_list_)
return;
observer_list_->Notify(FROM_HERE,
@@ -846,6 +858,11 @@ void ServiceWorkerContextCore::OnControlleeRemoved(
version->version_id(), provider_host->client_uuid());
}
+void ServiceWorkerContextCore::OnDevToolsAttached(
+ ServiceWorkerVersion* version) {
+ lifetime_tracker_.AbortTiming(version->version_id());
+}
+
ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() {
return wrapper_->process_manager();
}

Powered by Google App Engine
This is Rietveld 408576698