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

Unified Diff: content/renderer/service_worker/embedded_worker_instance_client_impl.h

Issue 2307543002: ServiceWorker: Mojofication of EWInstance::StopWorker (Closed)
Patch Set: Incorporated with the review Created 4 years, 3 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/renderer/service_worker/embedded_worker_instance_client_impl.h
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.h b/content/renderer/service_worker/embedded_worker_instance_client_impl.h
index c17f311d8b5fc0545d43f04ff02a8f6f1b672e6f..e578aa25d362e6482d9c81882845b34d40b0a3bf 100644
--- a/content/renderer/service_worker/embedded_worker_instance_client_impl.h
+++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.h
@@ -6,9 +6,10 @@
#define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_CLIENT_IMPL_H_
#include "base/id_map.h"
+#include "base/optional.h"
#include "content/common/service_worker/embedded_worker.mojom.h"
#include "content/renderer/service_worker/embedded_worker_dispatcher.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/bindings/binding.h"
namespace content {
@@ -19,22 +20,36 @@ class EmbeddedWorkerInstanceClientImpl
EmbeddedWorkerDispatcher* dispatcher,
mojo::InterfaceRequest<mojom::EmbeddedWorkerInstanceClient> request);
- // Implementation of mojo interface
- void StartWorker(const EmbeddedWorkerStartParams& params) override;
-
- private:
EmbeddedWorkerInstanceClientImpl(
EmbeddedWorkerDispatcher* dispatcher,
mojo::InterfaceRequest<mojom::EmbeddedWorkerInstanceClient> request);
~EmbeddedWorkerInstanceClientImpl() override;
+ // Called from ServiceWorkerContextClient. Must call on the main thread.
+ void StopWorkerCompleted();
+
+ private:
+ // Implementation of mojo interface
dcheng 2016/09/30 08:25:28 Nit: This is usually worded as: // mojom::Embedded
shimazu 2016/10/06 03:50:51 Done.
+ void StartWorker(const EmbeddedWorkerStartParams& params) override;
+ void StopWorker(const StopWorkerCallback& callback) override;
+
+ // Handler of connection error bound to |binding_|
void OnError();
EmbeddedWorkerDispatcher* dispatcher_;
- mojo::StrongBinding<mojom::EmbeddedWorkerInstanceClient> binding_;
+ // This object will be bound to the main thread.
+ mojo::Binding<mojom::EmbeddedWorkerInstanceClient> binding_;
+ // This is valid before StartWorker is called. After that, this object
+ // will be passed to ServiceWorkerContextClient.
+ std::unique_ptr<EmbeddedWorkerInstanceClientImpl> temporal_self_;
dcheng 2016/09/30 08:25:28 This is a bit too clever. Let me try to think if t
shimazu 2016/10/06 03:50:51 I think this is needed because currently no browse
+
+ base::Optional<int> embedded_worker_id_;
EmbeddedWorkerDispatcher::WorkerWrapper* wrapper_;
+ // Stores callbacks
+ StopWorkerCallback stop_callback_;
+
DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstanceClientImpl);
};

Powered by Google App Engine
This is Rietveld 408576698