Index: content/child/service_worker/service_worker_dispatcher.h |
diff --git a/content/child/service_worker/service_worker_dispatcher.h b/content/child/service_worker/service_worker_dispatcher.h |
index fdb4d5943c637d122a73bfcc23f36a7792e900c6..877b8e14b1c3b12c5402d1577bcd2aef99203172 100644 |
--- a/content/child/service_worker/service_worker_dispatcher.h |
+++ b/content/child/service_worker/service_worker_dispatcher.h |
@@ -32,6 +32,7 @@ class ServiceWorkerMessageFilter; |
class ServiceWorkerProviderContext; |
class ThreadSafeSender; |
class WebServiceWorkerImpl; |
+class WebServiceWorkerRegistrationImpl; |
struct ServiceWorkerObjectInfo; |
struct ServiceWorkerVersionAttributes; |
@@ -87,8 +88,19 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer { |
// WebServiceWorkerImpl, in which case ownership is transferred to |
// the caller who must bounce it to a method that will associate it |
// with a WebCore::ServiceWorker. |
- WebServiceWorkerImpl* GetServiceWorker(const ServiceWorkerObjectInfo&, |
- bool adopt_handle); |
+ WebServiceWorkerImpl* GetServiceWorker( |
+ const ServiceWorkerObjectInfo& info, |
+ bool adopt_handle); |
+ |
+ // If an existing WebServiceWorkerRegistrationImpl exists for the |
+ // registration, it is returned; otherwise a WebServiceWorkerRegistrationImpl |
+ // is created and its ownership is transferred to the caller. If |
+ // |adopt_handle| is true, a ServiceWorkerRegistrationHandleReference will be |
+ // adopted for the specified registration. |
+ WebServiceWorkerRegistrationImpl* GetServiceWorkerRegistration( |
+ int registration_handle_id, |
+ const ServiceWorkerObjectInfo& info, |
+ bool adopt_handle); |
// |thread_safe_sender| needs to be passed in because if the call leads to |
// construction it will be needed. |
@@ -106,14 +118,18 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer { |
typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap; |
typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap; |
typedef std::map<int, ServiceWorkerProviderContext*> WorkerToProviderMap; |
+ typedef std::map<int, WebServiceWorkerRegistrationImpl*> |
+ RegistrationObjectMap; |
friend class WebServiceWorkerImpl; |
+ friend class WebServiceWorkerRegistrationImpl; |
// WorkerTaskRunner::Observer implementation. |
virtual void OnWorkerRunLoopStopped() OVERRIDE; |
void OnRegistered(int thread_id, |
int request_id, |
+ int registration_handle_id, |
const ServiceWorkerObjectInfo& info); |
void OnUnregistered(int thread_id, |
int request_id); |
@@ -126,6 +142,7 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer { |
blink::WebServiceWorkerState state); |
void OnSetVersionAttributes(int thread_id, |
int provider_id, |
+ int registration_handle_id, |
int changed_mask, |
const ServiceWorkerVersionAttributes& attributes); |
void OnSetControllerServiceWorker(int thread_id, |
@@ -139,22 +156,33 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer { |
void SetInstallingServiceWorker( |
int provider_id, |
+ int registration_handle_id, |
const ServiceWorkerObjectInfo& info); |
void SetWaitingServiceWorker( |
int provider_id, |
+ int registration_handle_id, |
const ServiceWorkerObjectInfo& info); |
void SetActiveServiceWorker( |
int provider_id, |
+ int registration_handle_id, |
const ServiceWorkerObjectInfo& info); |
// Keeps map from handle_id to ServiceWorker object. |
void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); |
void RemoveServiceWorker(int handle_id); |
+ // Keeps map from registration_handle_id to ServiceWorkerRegistration object. |
+ void AddServiceWorkerRegistration( |
+ int registration_handle_id, |
+ WebServiceWorkerRegistrationImpl* registration); |
+ void RemoveServiceWorkerRegistration( |
+ int registration_handle_id); |
+ |
CallbackMap pending_callbacks_; |
ScriptClientMap script_clients_; |
ProviderContextMap provider_contexts_; |
WorkerObjectMap service_workers_; |
+ RegistrationObjectMap registrations_; |
// A map for ServiceWorkers that are associated to a particular document |
// (e.g. as .current). |