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

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

Issue 2045153003: Speculatively launch Service Workers on mouse/touch events. [4/5] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated nhiroki's comment Created 4 years, 5 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.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index db5392c1fcd62226bbc6a6b777293a67979c1e15..4074eba464b6e1ad7c92c8bf62b01249aee59759 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -24,6 +24,7 @@
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
+#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "content/browser/service_worker/embedded_worker_instance.h"
@@ -651,6 +652,10 @@ class CONTENT_EXPORT ServiceWorkerVersion
// event ended).
void OnBeginEvent();
+ // Resets |start_worker_first_purpose_| and fires and clears all start
+ // callbacks.
+ void FinishStartWorker(ServiceWorkerStatusCode status);
+
const int64_t version_id_;
const int64_t registration_id_;
const GURL script_url_;
@@ -727,6 +732,10 @@ class CONTENT_EXPORT ServiceWorkerVersion
bool stop_when_devtools_detached_ = false;
+ // Keeps the first purpose of starting the worker for UMA. Cleared in
+ // FinishStartWorker().
+ base::Optional<ServiceWorkerMetrics::EventType> start_worker_first_purpose_;
+
base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion);
« no previous file with comments | « content/browser/service_worker/service_worker_metrics.cc ('k') | content/browser/service_worker/service_worker_version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698