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

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

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Rebased Created 3 years, 7 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_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 8d5fee4ae4ce73d8e25dbf95a8821f8d689d734c..9bc3aee08f03c1e03970ef05eb59da5ee986dcc1 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.
falken 2017/05/29 08:47:28 Can we add the comments about lifetime here. Who c
shimazu 2017/05/30 03:50:07 Done.
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,7 +87,7 @@ 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_; }
@@ -250,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
@@ -318,7 +321,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
~OneShotGetReadyCallback();
};
- ServiceWorkerProviderHost(int render_process_id,
+ ServiceWorkerProviderHost(int process_id,
ServiceWorkerProviderHostInfo info,
base::WeakPtr<ServiceWorkerContextCore> context,
ServiceWorkerDispatcherHost* dispatcher_host);
@@ -403,6 +406,14 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
ServiceWorkerDispatcherHost* dispatcher_host_;
bool allow_association_;
+ // |provider_| is the renderer-side Mojo endpoint for provider.
+ mojom::ServiceWorkerProviderAssociatedPtr provider_;
+ // |binding_| is the Mojo binding that keeps the connection to the
+ // renderer-side counterpart (content::ServiceWorkerNetworkProvider). When the
+ // connection bound on |binding_| gets killed from the renderer side, this
+ // provider will be destroyed.
kinuko 2017/05/23 12:57:20 nit: It feels the term 'provider' is used ambiguou
falken 2017/05/29 08:47:28 Yea or even better let's just write out "this cont
shimazu 2017/05/30 03:50:07 Done.
+ mojo::AssociatedBinding<mojom::ServiceWorkerProviderHost> binding_;
+
std::vector<base::Closure> queued_events_;
// Keeps ServiceWorkerWorkerClient pointers of dedicated or shared workers

Powered by Google App Engine
This is Rietveld 408576698