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

Unified Diff: content/child/service_worker/service_worker_dispatcher.h

Issue 535753002: ServiceWorker: Implement navigator.serviceWorker.getRegistration [2/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/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 80ae40aba44832cde45e66ad42ecb62b8970f385..742c4d7ee19dd7a49de9d19fc73a30395ba4186f 100644
--- a/content/child/service_worker/service_worker_dispatcher.h
+++ b/content/child/service_worker/service_worker_dispatcher.h
@@ -47,6 +47,9 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
typedef
blink::WebServiceWorkerProvider::WebServiceWorkerUnregistrationCallbacks
WebServiceWorkerUnregistrationCallbacks;
+ typedef
+ blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationCallbacks
+ WebServiceWorkerGetRegistrationCallbacks;
explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender);
virtual ~ServiceWorkerDispatcher();
@@ -65,6 +68,11 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
int provider_id,
const GURL& pattern,
WebServiceWorkerUnregistrationCallbacks* callbacks);
+ // Corresponds to navigator.serviceWorker.getRegistration()
+ void GetRegistration(
+ int provider_id,
+ const GURL& document_url,
+ WebServiceWorkerRegistrationCallbacks* callbacks);
// Called when a new provider context for a document is created. Usually
// this happens when a new document is being loaded, and is called much
@@ -126,6 +134,8 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
IDMapOwnPointer> RegistrationCallbackMap;
typedef IDMap<WebServiceWorkerUnregistrationCallbacks,
IDMapOwnPointer> UnregistrationCallbackMap;
+ typedef IDMap<WebServiceWorkerGetRegistrationCallbacks,
+ IDMapOwnPointer> GetRegistrationCallbackMap;
typedef std::map<int, blink::WebServiceWorkerProviderClient*> ScriptClientMap;
typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap;
typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap;
@@ -152,6 +162,10 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
void OnUnregistered(int thread_id,
int request_id,
bool is_success);
+ void OnDidGetRegistration(int thread_id,
+ int request_id,
+ const ServiceWorkerRegistrationObjectInfo& info,
+ const ServiceWorkerVersionAttributes& attrs);
void OnRegistrationError(int thread_id,
int request_id,
blink::WebServiceWorkerError::ErrorType error_type,
@@ -160,6 +174,11 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
int request_id,
blink::WebServiceWorkerError::ErrorType error_type,
const base::string16& message);
+ void OnGetRegistrationError(
+ int thread_id,
+ int request_id,
+ blink::WebServiceWorkerError::ErrorType error_type,
+ const base::string16& message);
void OnServiceWorkerStateChanged(int thread_id,
int handle_id,
blink::WebServiceWorkerState state);
@@ -206,8 +225,13 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
void RemoveServiceWorkerRegistration(
int registration_handle_id);
+ WebServiceWorkerRegistrationImpl* FindOrCreateRegistration(
+ const ServiceWorkerRegistrationObjectInfo& info,
+ const ServiceWorkerVersionAttributes& attrs);
+
RegistrationCallbackMap pending_registration_callbacks_;
UnregistrationCallbackMap pending_unregistration_callbacks_;
+ GetRegistrationCallbackMap pending_get_registration_callbacks_;
ScriptClientMap script_clients_;
ProviderContextMap provider_contexts_;
WorkerObjectMap service_workers_;

Powered by Google App Engine
This is Rietveld 408576698