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

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

Issue 912753002: Stop Service Workers that execute JavaScript for too long. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix timeout value Created 5 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_version.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index 609806107fc3b5ebbba57a601bb3917dbcbe8cc5..a44eb6948aba5e8136084b56d661951b010f4d43 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -316,6 +316,12 @@ class CONTENT_EXPORT ServiceWorkerVersion
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest,
+ TimeoutStartingWorker);
+ FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest,
+ TimeoutWorkerInEvent);
+ friend class ServiceWorkerVersionBrowserTest;
+
typedef ServiceWorkerVersion self;
typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap;
typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap;
@@ -323,6 +329,7 @@ class CONTENT_EXPORT ServiceWorkerVersion
~ServiceWorkerVersion() override;
// EmbeddedWorkerInstance::Listener overrides:
+ void OnScriptLoaded() override;
void OnStarted() override;
void OnStopped(EmbeddedWorkerInstance::Status old_status) override;
void OnReportException(const base::string16& error_message,
@@ -377,6 +384,7 @@ class CONTENT_EXPORT ServiceWorkerVersion
void OnFocusClient(int request_id, int client_id);
void OnSkipWaiting(int request_id);
void OnClaimClients(int request_id);
+ void OnPongFromWorker();
void OnFocusClientFinished(int request_id,
int client_id,
@@ -388,6 +396,11 @@ class CONTENT_EXPORT ServiceWorkerVersion
scoped_refptr<GetClientDocumentsCallback> callback,
const ServiceWorkerClientInfo& info);
+ void PingWorker();
kinuko 2015/02/18 13:06:25 Can we have a short comment about the ping protoco
falken 2015/02/23 05:00:06 Good idea. Done. I also added a short comment for
+ void StartPingWorker();
+ void SchedulePingWorker();
+ void OnPingTimeout();
+
void ScheduleStopWorker();
void StopWorkerIfIdle();
bool HasInflightRequests() const;
@@ -430,6 +443,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
ServiceWorkerScriptCacheMap script_cache_map_;
base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_;
base::OneShotTimer<ServiceWorkerVersion> update_timer_;
+ base::OneShotTimer<ServiceWorkerVersion> ping_worker_timer_;
+ bool ping_timed_out_;
bool is_doomed_;
std::vector<int> pending_skip_waiting_requests_;
bool skip_waiting_;

Powered by Google App Engine
This is Rietveld 408576698