Index: content/browser/service_worker/service_worker_provider_host.h |
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h |
index 386bee2300e5d4aded72e9dd32c541e2d1c0ec04..4d120140a258bcf71d3cf2a59e6c4be07b1de093 100644 |
--- a/content/browser/service_worker/service_worker_provider_host.h |
+++ b/content/browser/service_worker/service_worker_provider_host.h |
@@ -47,6 +47,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
public: |
using GetClientInfoCallback = |
base::Callback<void(const ServiceWorkerClientInfo&)>; |
+ using GetRegistrationForReadyCallback = |
+ base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
// If |render_frame_id| is MSG_ROUTING_NONE, this provider host works for the |
// worker context. |
@@ -155,6 +157,10 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
// |registration| claims the document to be controlled. |
void ClaimedByRegistration(ServiceWorkerRegistration* registration); |
+ // Called by dispatcher host to get the registration for the "ready" property. |
+ // http://www.w3.org/TR/service-workers/#navigator-service-worker-ready. |
falken
2015/02/16 09:18:29
nit: We always link to the latest editor's draft:
xiang
2015/02/26 06:52:14
Done.
|
+ void GetRegistrationForReady(const GetRegistrationForReadyCallback& callback); |
+ |
// Methods to support cross site navigations. |
void PrepareForCrossSiteTransfer(); |
void CompleteCrossSiteTransfer( |
@@ -183,6 +189,13 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
// Sets the worker thread id and flushes queued events. |
void SetReadyToSendMessagesToWorker(int render_thread_id); |
+ void AddMatchingRegistration(ServiceWorkerRegistration* registration); |
+ void RemoveMatchingRegistration(ServiceWorkerRegistration* registration); |
+ |
+ // An optimized implementation of [[Match Service Worker Registration]] |
+ // for current document. |
+ ServiceWorkerRegistration* MatchRegistration() const; |
+ |
private: |
friend class ServiceWorkerProviderHostTest; |
friend class ServiceWorkerWriteToCacheJobTest; |
@@ -192,7 +205,13 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
UpdateAfter24Hours); |
// ServiceWorkerRegistration::Listener overrides. |
+ void OnVersionAttributesChanged( |
+ ServiceWorkerRegistration* registration, |
+ ChangedVersionAttributesMask changed_mask, |
+ const ServiceWorkerRegistrationInfo& info) override; |
void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; |
+ void OnRegistrationFinishedUninstalling( |
+ ServiceWorkerRegistration* registration) override; |
void OnSkippedWaiting(ServiceWorkerRegistration* registration) override; |
// Sets the controller version field to |version| or if |version| is NULL, |
@@ -205,6 +224,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
void IncreaseProcessReference(const GURL& pattern); |
void DecreaseProcessReference(const GURL& pattern); |
+ void ReturnRegistrationForReadyIfNeeded(); |
+ |
bool IsReadyToSendMessages() const; |
void Send(IPC::Message* message) const; |
@@ -218,6 +239,14 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
std::vector<GURL> associated_patterns_; |
scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
+ // Keyed by registration scope URL length. |
+ typedef std::map<size_t, scoped_refptr<ServiceWorkerRegistration>> |
+ ServiceWorkerRegistrationMap; |
+ // Contains all living registrations which has pattern this document's |
+ // URL starts with. |
+ ServiceWorkerRegistrationMap matching_registrations_; |
+ |
+ GetRegistrationForReadyCallback get_ready_callback_; |
scoped_refptr<ServiceWorkerVersion> controlling_version_; |
scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
base::WeakPtr<ServiceWorkerContextCore> context_; |