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

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

Issue 832813002: [ServiceWorker] Keep ServiceWorker alive while streaming the response for FetchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 6e02c2d436ff4c634e9db5abf3947e0909da3a6a..2b9da6a12c66a7bdcbf776b58b87acb9b4c0c601 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -6,6 +6,7 @@
#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
#include <map>
+#include <set>
#include <string>
#include <vector>
@@ -40,6 +41,7 @@ struct PlatformNotificationData;
class ServiceWorkerContextCore;
class ServiceWorkerProviderHost;
class ServiceWorkerRegistration;
+class ServiceWorkerURLRequestJob;
class ServiceWorkerVersionInfo;
// This class corresponds to a specific version of a ServiceWorker
@@ -266,6 +268,13 @@ class CONTENT_EXPORT ServiceWorkerVersion
// Returns if it has controllee.
bool HasControllee() const { return !controllee_map_.empty(); }
+ // Adds and removes |request_job| as a dependent job not to stop the
+ // ServiceWorker while |request_job| is reading the stream of the fetch event
+ // response from the ServiceWorker.
+ void AddStreamingURLRequestJob(const ServiceWorkerURLRequestJob* request_job);
+ void RemoveStreamingURLRequestJob(
+ const ServiceWorkerURLRequestJob* request_job);
+
// Adds and removes Listeners.
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
@@ -287,6 +296,7 @@ class CONTENT_EXPORT ServiceWorkerVersion
class GetClientDocumentsCallback;
friend class base::RefCounted<ServiceWorkerVersion>;
+ friend class ServiceWorkerURLRequestJobTest;
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest,
ActivateWaitingVersion);
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker);
@@ -384,6 +394,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
IDMap<CrossOriginConnectCallback, IDMapOwnPointer>
cross_origin_connect_callbacks_;
+ std::set<const ServiceWorkerURLRequestJob*> streaming_url_request_jobs_;
+
ControlleeMap controllee_map_;
ControlleeByIDMap controllee_by_id_;
base::WeakPtr<ServiceWorkerContextCore> context_;

Powered by Google App Engine
This is Rietveld 408576698