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

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

Issue 761923004: Keep alive ServiceWorkers when devtools is attached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ASSERT_TRUE -> DCHECK :( Created 6 years 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/embedded_worker_instance.h
diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h
index b5d57296ce57419da65aa9740b193d6065380686..5f1f1cdc372776c8b59406ea2cc89b9abe389a48 100644
--- a/content/browser/service_worker/embedded_worker_instance.h
+++ b/content/browser/service_worker/embedded_worker_instance.h
@@ -86,6 +86,11 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
// IPC couldn't be sent to the worker.
ServiceWorkerStatusCode Stop();
+ // Stops the worker if the worker is not being debugged (i.e. devtools is
+ // not attached). This method is called by a stop-worker timer to kill
+ // idle workers.
+ void StopIfIdle();
+
// Sends |message| to the embedded worker running in the child process.
// It is invalid to call this while the worker is not in RUNNING status.
ServiceWorkerStatusCode SendMessage(const IPC::Message& message);
@@ -104,6 +109,8 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
+ void set_devtools_attached(bool attached) { devtools_attached_ = attached; }
+
private:
typedef ObserverList<Listener> ListenerList;
@@ -192,6 +199,9 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
int thread_id_;
int worker_devtools_agent_route_id_;
+ // Whether devtools is attached or not.
+ bool devtools_attached_;
+
StatusCallback start_callback_;
ListenerList listener_list_;

Powered by Google App Engine
This is Rietveld 408576698