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 61b1c5e765f449b617e45ab63213bfa704d5f840..12f0eaeedf21ffd36a7b8c9c488f257a878dcf21 100644 |
--- a/content/browser/service_worker/service_worker_provider_host.h |
+++ b/content/browser/service_worker/service_worker_provider_host.h |
@@ -48,6 +48,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
using FocusCallback = base::Callback<void(bool)>; |
using GetClientInfoCallback = |
base::Callback<void(const ServiceWorkerClientInfo&)>; |
+ using GetReadyRegistrationCallback = |
+ base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
// If |render_frame_id| is MSG_ROUTING_NONE, this provider host works for the |
// worker context. |
@@ -157,6 +159,9 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
// |registration| claims the document to be controlled. |
void ClaimedByRegistration(ServiceWorkerRegistration* registration); |
+ // Calls by dispatcher host to get "ready" registration. |
dominicc (has gone to gerrit)
2015/02/10 04:10:53
Calls -> Called
"ready" registration -> the regis
xiang
2015/02/12 07:14:22
Done.
|
+ void GetReadyRegistration(const GetReadyRegistrationCallback& callback); |
+ |
// Methods to support cross site navigations. |
void PrepareForCrossSiteTransfer(); |
void CompleteCrossSiteTransfer( |
@@ -185,6 +190,11 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
// Sets the worker thread id and flushes queued events. |
void SetReadyToSendMessagesToWorker(int render_thread_id); |
+ // Potential registrations contain all registrations match this document URL. |
+ void AddPotentialRegistration(ServiceWorkerRegistration* registration); |
+ void RemovePotentialRegistration(ServiceWorkerRegistration* registration); |
+ ServiceWorkerRegistration* GetMatchedRegistration() const; |
dominicc (has gone to gerrit)
2015/02/10 04:10:54
I think it would be helpful to reference https://s
xiang
2015/02/12 07:14:22
Done. It's an optimized impl of the algorithm for
|
+ |
private: |
friend class ServiceWorkerProviderHostTest; |
friend class ServiceWorkerWriteToCacheJobTest; |
@@ -194,7 +204,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, |
@@ -207,6 +223,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
void IncreaseProcessReference(const GURL& pattern); |
void DecreaseProcessReference(const GURL& pattern); |
+ void ReturnReadyRegistrationIfNeeded(); |
+ |
bool IsReadyToSendMessages() const; |
void Send(IPC::Message* message) const; |
@@ -220,6 +238,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 associated registration and matched registartions created |
dominicc (has gone to gerrit)
2015/02/10 04:10:53
Spelling: registrations
I think this is too confu
xiang
2015/02/12 07:14:22
Done, I tweaked these comments and names, please t
|
+ // during the document's lifetime. |
+ ServiceWorkerRegistrationMap potential_registrations_; |
+ |
+ GetReadyRegistrationCallback registration_ready_callback_; |
scoped_refptr<ServiceWorkerVersion> controlling_version_; |
scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
base::WeakPtr<ServiceWorkerContextCore> context_; |