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

Unified Diff: content/child/service_worker/service_worker_provider_context.h

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Skip unittest for CrossSiteTransfer when PlzNavigate 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/child/service_worker/service_worker_provider_context.h
diff --git a/content/child/service_worker/service_worker_provider_context.h b/content/child/service_worker/service_worker_provider_context.h
index 192be968692b86a8b7e28e4e62823dd9cc1015ae..26c8c0ef0485638c27e95403d1d0f34ee96383ff 100644
--- a/content/child/service_worker/service_worker_provider_context.h
+++ b/content/child/service_worker/service_worker_provider_context.h
@@ -13,7 +13,9 @@
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner_helpers.h"
#include "content/common/content_export.h"
+#include "content/common/service_worker/service_worker_provider_interfaces.mojom.h"
#include "content/common/service_worker/service_worker_types.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
namespace base {
class SingleThreadTaskRunner;
@@ -44,11 +46,19 @@ class ThreadSafeSender;
// ControlleeDelegate and ControllerDelegate.
class CONTENT_EXPORT ServiceWorkerProviderContext
: public base::RefCountedThreadSafe<ServiceWorkerProviderContext,
- ServiceWorkerProviderContextDeleter> {
+ ServiceWorkerProviderContextDeleter>,
+ NON_EXPORTED_BASE(public mojom::ServiceWorkerProvider) {
public:
- ServiceWorkerProviderContext(int provider_id,
- ServiceWorkerProviderType provider_type,
- ThreadSafeSender* thread_safe_sender);
+ // |provider_id| specifies which host will receive the message from this
+ // provider. |provider_type| changes the behavior of this provider
+ // context. |request| is an endpoint which is connected to
+ // content::ServiceWorkerProviderHost which notifies changes of the
+ // registration's and workers' status. |request| is bound with |binding_|.
+ ServiceWorkerProviderContext(
+ int provider_id,
+ ServiceWorkerProviderType provider_type,
+ mojom::ServiceWorkerProviderAssociatedRequest request,
+ ThreadSafeSender* thread_safe_sender);
// Called from ServiceWorkerDispatcher.
void OnAssociateRegistration(
@@ -84,12 +94,16 @@ class CONTENT_EXPORT ServiceWorkerProviderContext
class ControlleeDelegate;
class ControllerDelegate;
- ~ServiceWorkerProviderContext();
+ ~ServiceWorkerProviderContext() override;
void DestructOnMainThread() const;
const int provider_id_;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+ // Mojo binding for the |request| passed to the constructor. This keeps the
+ // connection to the content::ServiceWorkerProviderHost in the browser process
+ // alive.
+ mojo::AssociatedBinding<mojom::ServiceWorkerProvider> binding_;
std::unique_ptr<Delegate> delegate_;

Powered by Google App Engine
This is Rietveld 408576698