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

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: patch for review 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 6ff4fa5bf0d6c61ad63fc5c68d64fd5803dfeba2..192b2ecdb3a9efcaa0e75d4e11d0649b6a008f44 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
@@ -119,6 +127,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;
@@ -138,6 +148,10 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
const ServiceWorkerVersionAttributes& attrs);
void OnUnregistered(int thread_id,
int request_id);
+ 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,
@@ -146,6 +160,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);
@@ -191,6 +210,7 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
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