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

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

Issue 2787883003: [ServiceWorker] Add EmbeddedWorkerInstanceHost Interface. (Closed)
Patch Set: Created 3 years, 9 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/embedded_worker_instance.h
diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h
index ca5d522cd3500b0e1719f730a61c9c5a1667bc83..bd600c49be433518cf0d2f3e96df6dd73b39981d 100644
--- a/content/browser/service_worker/embedded_worker_instance.h
+++ b/content/browser/service_worker/embedded_worker_instance.h
@@ -26,6 +26,7 @@
#include "content/common/service_worker/embedded_worker.mojom.h"
#include "content/common/service_worker/service_worker_event_dispatcher.mojom.h"
#include "content/common/service_worker/service_worker_status_code.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
#include "url/gurl.h"
// Windows headers will redefine SendMessage.
@@ -46,7 +47,8 @@ class ServiceWorkerContextCore;
// This gives an interface to control one EmbeddedWorker instance, which
// may be 'in-waiting' or running in one of the child processes added by
// AddProcessReference().
-class CONTENT_EXPORT EmbeddedWorkerInstance {
+class CONTENT_EXPORT EmbeddedWorkerInstance
+ : NON_EXPORTED_BASE(public mojom::EmbeddedWorkerInstanceHost) {
public:
typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback;
@@ -99,7 +101,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
CONTENT_EXPORT virtual bool OnMessageReceived(const IPC::Message& message);
};
- ~EmbeddedWorkerInstance();
+ ~EmbeddedWorkerInstance() override;
// Starts the worker. It is invalid to call this when the worker is not in
// STOPPED status. |callback| is invoked after the worker script has been
@@ -202,6 +204,11 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context,
int embedded_worker_id);
+ // mojom::EmbeddedWorkerInstanceHost
+ // Be called when the worker instance has ack'ed that
+ // it is ready for inspection.
+ void OnReadyForInspection() override;
+
// Called back from StartTask after a process is allocated on the UI thread.
void OnProcessAllocated(std::unique_ptr<WorkerProcessHandle> handle,
ServiceWorkerMetrics::StartSituation start_situation);
@@ -220,10 +227,6 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
void OnStartWorkerMessageSent();
// Called back from Registry when the worker instance has ack'ed that
- // it is ready for inspection.
- void OnReadyForInspection();
-
- // Called back from Registry when the worker instance has ack'ed that
// it finished loading the script.
void OnScriptLoaded();
@@ -303,6 +306,9 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
// |client_| is used to send messages to the renderer process.
mojom::EmbeddedWorkerInstanceClientPtr client_;
+ // Binding for EmbeddedWorkerInstanceHost, runs on IO thread.
+ mojo::AssociatedBinding<EmbeddedWorkerInstanceHost> instance_host_binding_;
+
// TODO(shimazu): Remove this after EmbeddedWorkerStartParams is changed to
// a mojo struct.
mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_;

Powered by Google App Engine
This is Rietveld 408576698