Index: content/browser/service_worker/service_worker_dispatcher_host.h |
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.h b/content/browser/service_worker/service_worker_dispatcher_host.h |
index 7e75b4984348d996ff312e230a709af989450caa..e7e9ba31743403051bb313fb5608d07ef61a3f8d 100644 |
--- a/content/browser/service_worker/service_worker_dispatcher_host.h |
+++ b/content/browser/service_worker/service_worker_dispatcher_host.h |
@@ -20,6 +20,7 @@ |
#include "content/common/service_worker/service_worker_types.h" |
#include "content/public/browser/browser_message_filter.h" |
#include "mojo/public/cpp/bindings/associated_binding_set.h" |
+#include "mojo/public/cpp/bindings/strong_associated_binding_set.h" |
class GURL; |
@@ -44,7 +45,8 @@ struct ServiceWorkerVersionAttributes; |
// This class is bound with mojom::ServiceWorkerDispatcherHost. All |
// InterfacePtrs on the same render process are bound to the same |
-// content::ServiceWorkerDispatcherHost. |
+// content::ServiceWorkerDispatcherHost. This can be overridden only for |
+// testing. |
class CONTENT_EXPORT ServiceWorkerDispatcherHost |
: public mojom::ServiceWorkerDispatcherHost, |
public BrowserMessageFilter { |
@@ -53,6 +55,8 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost |
int render_process_id, |
ResourceContext* resource_context); |
+ // |blob_storage_context| and |loader_factory_getter| are used only |
+ // if IsServicificationEnabled is true. |
void Init(ServiceWorkerContextWrapper* context_wrapper); |
// BrowserMessageFilter implementation |
@@ -69,13 +73,22 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost |
// be destroyed. |
bool Send(IPC::Message* message) override; |
- void RegisterServiceWorkerHandle(std::unique_ptr<ServiceWorkerHandle> handle); |
- void RegisterServiceWorkerRegistrationHandle( |
+ // Virtual for testing. |
+ virtual void RegisterServiceWorkerHandle( |
+ std::unique_ptr<ServiceWorkerHandle> handle); |
+ // Virtual for testing. |
+ virtual void RegisterServiceWorkerRegistrationHandle( |
std::unique_ptr<ServiceWorkerRegistrationHandle> handle); |
ServiceWorkerHandle* FindServiceWorkerHandle(int provider_id, |
int64_t version_id); |
+ void GetRegistrationObjectInfoAndVersionAttributes( |
+ base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
+ ServiceWorkerRegistration* registration, |
+ ServiceWorkerRegistrationObjectInfo* out_info, |
+ ServiceWorkerVersionAttributes* out_attrs); |
+ |
// Returns the existing registration handle whose reference count is |
// incremented or a newly created one if it doesn't exist. |
ServiceWorkerRegistrationHandle* GetOrCreateRegistrationHandle( |
@@ -94,6 +107,8 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost |
ProviderCreatedAndDestroyed); |
FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, |
CleanupOnRendererCrash); |
+ FRIEND_TEST_ALL_PREFIXES(BackgroundSyncManagerTest, |
+ RegisterWithoutLiveSWRegistration); |
using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; |
enum class ProviderStatus { OK, NO_CONTEXT, DEAD_HOST, NO_HOST, NO_URL }; |
@@ -104,9 +119,6 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost |
// mojom::ServiceWorkerDispatcherHost implementation |
void OnProviderCreated(ServiceWorkerProviderHostInfo info) override; |
- void OnSetHostedVersionId(int provider_id, |
- int64_t version_id, |
- int embedded_worker_id) override; |
// IPC Message handlers |
void OnRegisterServiceWorker(int thread_id, |
@@ -195,12 +207,6 @@ class CONTENT_EXPORT ServiceWorkerDispatcherHost |
int provider_id, |
int64_t registration_handle_id); |
- void GetRegistrationObjectInfoAndVersionAttributes( |
- base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
- ServiceWorkerRegistration* registration, |
- ServiceWorkerRegistrationObjectInfo* info, |
- ServiceWorkerVersionAttributes* attrs); |
- |
// Callbacks from ServiceWorkerContextCore |
void RegistrationComplete(int thread_id, |
int provider_id, |