Chromium Code Reviews| Index: content/renderer/shared_worker/websharedworker_proxy.h |
| diff --git a/content/renderer/shared_worker/websharedworker_proxy.h b/content/renderer/shared_worker/websharedworker_proxy.h |
| index cb9a9c3c84a1387e58b641cd321c067abe1c1f8e..64ac8a11c30a7152d939da8eb5fbc6ebd4f43556 100644 |
| --- a/content/renderer/shared_worker/websharedworker_proxy.h |
| +++ b/content/renderer/shared_worker/websharedworker_proxy.h |
| @@ -5,13 +5,17 @@ |
| #ifndef CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_ |
| #define CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_ |
| -#include <string> |
| -#include <vector> |
| - |
| -#include "base/compiler_specific.h" |
| #include "base/macros.h" |
| #include "ipc/ipc_listener.h" |
| -#include "third_party/WebKit/public/web/WebSharedWorkerConnector.h" |
| +#include "third_party/WebKit/public/web/WebSharedWorkerConnectListener.h" |
| +#include "third_party/WebKit/public/web/WebSharedWorkerCreationErrors.h" |
| + |
| +struct ViewHostMsg_CreateWorker_Params; |
| + |
| +namespace blink { |
| +class WebMessagePortChannel; |
| +class WebSharedWorkerConnectListener; |
| +} |
| namespace IPC { |
| class MessageRouter; |
| @@ -22,17 +26,18 @@ namespace content { |
| // Implementation of the WebSharedWorker APIs. This object is intended to only |
| // live long enough to allow the caller to send a "connect" event to the worker |
| // thread. Once the connect event has been sent, all future communication will |
| -// happen via the WebMessagePortChannel, and the WebSharedWorker instance will |
| -// be freed. |
| -class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector, |
| - private IPC::Listener { |
| +// happen via the WebMessagePortChannel. This instance will self-destruct when a |
| +// connection is established. |
| +class WebSharedWorkerProxy : private IPC::Listener { |
| public: |
| - WebSharedWorkerProxy(IPC::MessageRouter* router, int route_id); |
| + explicit WebSharedWorkerProxy( |
| + std::unique_ptr<blink::WebSharedWorkerConnectListener> listener); |
| ~WebSharedWorkerProxy() override; |
| - // Implementations of WebSharedWorkerConnector APIs |
| - void connect(blink::WebMessagePortChannel* channel, |
| - ConnectListener* listener) override; |
| + // This is expected to be called immediately after this proxy is constructed. |
|
kinuko
2017/01/18 09:13:30
Can the work for connect be done in the ctor? The
nhiroki
2017/01/18 09:38:03
Done.
(Generally I'd prefer only to do initializa
|
| + // |channel| should be passed with its ownership. |
| + void connect(ViewHostMsg_CreateWorker_Params params, |
| + blink::WebMessagePortChannel* channel); |
| private: |
| // IPC::Listener implementation. |
| @@ -46,12 +51,12 @@ class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector, |
| // worker, and also to route messages to the worker (WorkerService contains |
| // a map that maps between these renderer-side route IDs and worker-side |
| // routing ids). |
| - const int route_id_; |
| + int route_id_; |
| IPC::MessageRouter* const router_; |
| int message_port_id_; |
| - ConnectListener* connect_listener_; |
| + std::unique_ptr<blink::WebSharedWorkerConnectListener> listener_; |
| DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
| }; |