Chromium Code Reviews| 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 f8ab188a30f7b2cbc61f1e0927dbe8f6e621b3e4..9acbfd5ec8a4d94261bbba186964bedaf4aaeebc 100644 |
| --- a/content/browser/service_worker/service_worker_provider_host.h |
| +++ b/content/browser/service_worker/service_worker_provider_host.h |
| @@ -22,11 +22,13 @@ |
| #include "content/browser/service_worker/service_worker_registration.h" |
| #include "content/common/content_export.h" |
| #include "content/common/service_worker/service_worker_provider_host_info.h" |
| +#include "content/common/service_worker/service_worker_provider_interfaces.mojom.h" |
| #include "content/common/service_worker/service_worker_types.h" |
| #include "content/common/worker_url_loader_factory_provider.mojom.h" |
| #include "content/public/common/request_context_frame_type.h" |
| #include "content/public/common/request_context_type.h" |
| #include "content/public/common/resource_type.h" |
| +#include "mojo/public/cpp/bindings/associated_binding.h" |
| namespace storage { |
| class BlobStorageContext; |
| @@ -56,7 +58,8 @@ class WebContents; |
| // resource loads made directly by the service worker. |
| class CONTENT_EXPORT ServiceWorkerProviderHost |
| : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), |
| - public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
| + public base::SupportsWeakPtr<ServiceWorkerProviderHost>, |
| + public NON_EXPORTED_BASE(mojom::ServiceWorkerProviderHost) { |
| public: |
| using GetRegistrationForReadyCallback = |
| base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
| @@ -84,18 +87,18 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| base::WeakPtr<ServiceWorkerContextCore> context, |
| ServiceWorkerDispatcherHost* dispatcher_host); |
| - virtual ~ServiceWorkerProviderHost(); |
| + ~ServiceWorkerProviderHost() override; |
| const std::string& client_uuid() const { return client_uuid_; } |
| int process_id() const { return render_process_id_; } |
| - int provider_id() const { return provider_id_; } |
| + int provider_id() const { return info_.provider_id; } |
| int frame_id() const; |
| - int route_id() const { return route_id_; } |
| + int route_id() const { return info_.route_id; } |
| const WebContentsGetter& web_contents_getter() const { |
| return web_contents_getter_; |
| } |
| - bool is_parent_frame_secure() const { return is_parent_frame_secure_; } |
| + bool is_parent_frame_secure() const { return info_.is_parent_frame_secure; } |
| // Returns whether this provider host is secure enough to have a service |
| // worker controller. |
| @@ -157,7 +160,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| ServiceWorkerVersion* running_hosted_version() const { |
| // Only providers for controllers can host a running version. |
| DCHECK(!running_hosted_version_ || |
| - provider_type_ == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER); |
| + info_.type == SERVICE_WORKER_PROVIDER_FOR_CONTROLLER); |
| return running_hosted_version_.get(); |
| } |
| @@ -170,7 +173,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| void SetTopmostFrameUrl(const GURL& url); |
| const GURL& topmost_frame_url() const { return topmost_frame_url_; } |
| - ServiceWorkerProviderType provider_type() const { return provider_type_; } |
| + ServiceWorkerProviderType provider_type() const { return info_.type; } |
| bool IsProviderForClient() const; |
| blink::WebServiceWorkerClientType client_type() const; |
| @@ -241,12 +244,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| // Methods to support cross site navigations. |
| std::unique_ptr<ServiceWorkerProviderHost> PrepareForCrossSiteTransfer(); |
| - void CompleteCrossSiteTransfer( |
| - int new_process_id, |
| - int new_frame_id, |
| - int new_provider_id, |
| - ServiceWorkerProviderType new_provider_type, |
| - ServiceWorkerDispatcherHost* dispatcher_host); |
| + void CompleteCrossSiteTransfer(ServiceWorkerProviderHost* provisional_host); |
| ServiceWorkerDispatcherHost* dispatcher_host() const { |
| return dispatcher_host_; |
| } |
| @@ -255,7 +253,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| // Completes initialization of provider hosts used for navigation requests. |
| void CompleteNavigationInitialized( |
| int process_id, |
| - int frame_routing_id, |
| + ServiceWorkerProviderHostInfo info, |
| ServiceWorkerDispatcherHost* dispatcher_host); |
| // Sends event messages to the renderer. Events for the worker are queued up |
| @@ -323,11 +321,8 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| ~OneShotGetReadyCallback(); |
| }; |
| - ServiceWorkerProviderHost(int render_process_id, |
| - int route_id, |
| - int provider_id, |
| - ServiceWorkerProviderType provider_type, |
| - bool is_parent_frame_secure, |
| + ServiceWorkerProviderHost(int process_id, |
| + ServiceWorkerProviderHostInfo info, |
| base::WeakPtr<ServiceWorkerContextCore> context, |
| ServiceWorkerDispatcherHost* dispatcher_host); |
| @@ -376,25 +371,20 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| std::string client_uuid_; |
| int render_process_id_; |
| - // See the constructor's documentation. |
| - int route_id_; |
| - |
| // For provider hosts that are hosting a running service worker, the id of the |
| // service worker thread. Otherwise, |kDocumentMainThreadId|. May be |
| // |kInvalidEmbeddedWorkerThreadId| before the hosted service worker starts |
| // up, or during cross-site transfers. |
| int render_thread_id_; |
| - // Unique within the renderer process. |
| - int provider_id_; |
| + // Keeps the basic provider info provided from the renderer side. |
| + ServiceWorkerProviderHostInfo info_; |
| // PlzNavigate |
| // Only set when this object is pre-created for a navigation. It indicates the |
| // tab where the navigation occurs. |
| WebContentsGetter web_contents_getter_; |
| - ServiceWorkerProviderType provider_type_; |
| - const bool is_parent_frame_secure_; |
|
falken
2017/05/18 04:13:09
Can you put the refactoring to ServiceWorkerProvid
shimazu
2017/05/19 08:31:06
Done.
|
| GURL document_url_; |
| GURL topmost_frame_url_; |
| @@ -416,6 +406,9 @@ class CONTENT_EXPORT ServiceWorkerProviderHost |
| ServiceWorkerDispatcherHost* dispatcher_host_; |
| bool allow_association_; |
| + mojom::ServiceWorkerProviderAssociatedPtr client_; |
|
falken
2017/05/18 04:13:09
"client" is a really overloaded word in service wo
shimazu
2017/05/19 08:31:06
Sounds good! Done.
|
| + mojo::AssociatedBinding<mojom::ServiceWorkerProviderHost> binding_; |
| + |
| std::vector<base::Closure> queued_events_; |
| // Keeps ServiceWorkerWorkerClient pointers of dedicated or shared workers |