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

Side by Side Diff: content/renderer/shared_worker/websharedworker_proxy.h

Issue 2600113003: (SUSPENDED) SharedWorker: Mojofy Renderer(Document)->Browser communication for SharedWorker
Patch Set: address review comments Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_ 5 #ifndef CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_
6 #define CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_ 6 #define CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/common/shared_worker.mojom.h"
13 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
14 #include "third_party/WebKit/public/web/WebSharedWorkerConnector.h" 15 #include "third_party/WebKit/public/web/WebSharedWorkerConnector.h"
15 16
16 namespace IPC { 17 namespace IPC {
17 class MessageRouter; 18 class MessageRouter;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 22
22 // Implementation of the WebSharedWorker APIs. This object is intended to only 23 // Implementation of the WebSharedWorker APIs. This object is intended to only
23 // live long enough to allow the caller to send a "connect" event to the worker 24 // live long enough to allow the caller to send a "connect" event to the worker
24 // thread. Once the connect event has been sent, all future communication will 25 // thread. Once the connect event has been sent, all future communication will
25 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will 26 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will
26 // be freed. 27 // be freed.
27 class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector, 28 class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector,
28 private IPC::Listener { 29 private IPC::Listener {
29 public: 30 public:
30 WebSharedWorkerProxy(IPC::MessageRouter* router, int route_id); 31 explicit WebSharedWorkerProxy(int route_id);
31 ~WebSharedWorkerProxy() override; 32 ~WebSharedWorkerProxy() override;
32 33
33 // Implementations of WebSharedWorkerConnector APIs 34 // Implementations of WebSharedWorkerConnector APIs
34 void connect(blink::WebMessagePortChannel* channel, 35 void connect(blink::WebMessagePortChannel* channel,
35 ConnectListener* listener) override; 36 ConnectListener* listener) override;
36 37
37 private: 38 private:
38 // IPC::Listener implementation. 39 // IPC::Listener implementation.
39 bool OnMessageReceived(const IPC::Message& message) override; 40 bool OnMessageReceived(const IPC::Message& message) override;
40 41
41 void OnWorkerCreated(); 42 void OnWorkerCreated();
42 void OnWorkerScriptLoadFailed(); 43 void OnWorkerScriptLoadFailed();
43 void OnWorkerConnected(); 44 void OnWorkerConnected();
44 45
45 // Routing id associated with this worker - used to receive messages from the 46 // Routing id associated with this worker - used to receive messages from the
46 // worker, and also to route messages to the worker (WorkerService contains 47 // worker, and also to route messages to the worker (WorkerService contains
47 // a map that maps between these renderer-side route IDs and worker-side 48 // a map that maps between these renderer-side route IDs and worker-side
48 // routing ids). 49 // routing ids).
49 const int route_id_; 50 const int route_id_;
50 51
52 int message_port_id_;
53
51 IPC::MessageRouter* const router_; 54 IPC::MessageRouter* const router_;
52 55 mojom::SharedWorkerMessageFilterAssociatedPtr message_filter_;
53 int message_port_id_;
54 ConnectListener* connect_listener_; 56 ConnectListener* connect_listener_;
55 57
56 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); 58 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy);
57 }; 59 };
58 60
59 } // namespace content 61 } // namespace content
60 62
61 #endif // CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_ 63 #endif // CONTENT_RENDERER_SHARED_WORKER_WEBSHAREDWORKER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698