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

Unified Diff: content/browser/service_worker/service_worker_version.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/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 dcfb3cc3b25a7ae34d2fdd13decc2dbcdcb50138..e625cf18ed6900f2facfcb88313cbae708bb3919 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -253,6 +253,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
bool skip_waiting() const { return skip_waiting_; }
+ void SetDevToolsAttached(bool attached);
+
private:
class GetClientDocumentsCallback;
class GetClientInfoCallback;
@@ -261,6 +263,7 @@ class CONTENT_EXPORT ServiceWorkerVersion
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest,
ActivateWaitingVersion);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability);
typedef ServiceWorkerVersion self;
typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap;
@@ -319,6 +322,9 @@ class CONTENT_EXPORT ServiceWorkerVersion
void OnFocusClientFinished(int request_id, bool result);
void DidSkipWaiting(int request_id);
void ScheduleStopWorker();
+ void StopWorkerIfIdle();
+ bool HasInflightRequests() const;
+
void DoomInternal();
const int64 version_id_;
@@ -332,7 +338,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
std::vector<StatusCallback> stop_callbacks_;
std::vector<base::Closure> status_change_callbacks_;
- // Message callbacks.
+ // Message callbacks. (Update HasInflightRequests() too when you update this
+ // list.)
IDMap<StatusCallback, IDMapOwnPointer> activate_callbacks_;
IDMap<StatusCallback, IDMapOwnPointer> install_callbacks_;
IDMap<FetchCallback, IDMapOwnPointer> fetch_callbacks_;

Powered by Google App Engine
This is Rietveld 408576698