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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.h

Issue 2779763004: Create ServiceWorkerProviderHost before starting worker (Closed)
Patch Set: Fix ForeignFetchRequestHandlerTest.InitializeHandler_TimeoutBehaviorForServiceWorker Created 3 years, 6 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/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..154588d22930d76002c28d2939723f2679ec2b20 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.h
+++ b/content/browser/service_worker/service_worker_dispatcher_host.h
@@ -44,7 +44,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 {
@@ -69,13 +70,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);
falken 2017/06/06 14:06:33 Now that this is public let's clean it up a little
shimazu 2017/06/12 06:08:12 Acknowledged.
+ void GetRegistrationObjectInfoAndVersionAttributes(
+ base::WeakPtr<ServiceWorkerProviderHost> provider_host,
+ ServiceWorkerRegistration* registration,
+ ServiceWorkerRegistrationObjectInfo* info,
falken 2017/06/06 14:06:34 out_info
shimazu 2017/06/12 06:08:12 Done.
+ ServiceWorkerVersionAttributes* attrs);
falken 2017/06/06 14:06:33 out_attrs
shimazu 2017/06/12 06:08:12 Done.
+
// Returns the existing registration handle whose reference count is
// incremented or a newly created one if it doesn't exist.
ServiceWorkerRegistrationHandle* GetOrCreateRegistrationHandle(
@@ -94,6 +104,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 +116,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 +204,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,

Powered by Google App Engine
This is Rietveld 408576698