OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EMBEDDED_SHARED_WORKER_STUB_H_ | 5 #ifndef CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ |
6 #define CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ | 6 #define CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace blink { | 21 namespace blink { |
22 class WebApplicationCacheHost; | 22 class WebApplicationCacheHost; |
23 class WebApplicationCacheHostClient; | 23 class WebApplicationCacheHostClient; |
24 class WebNotificationPresenter; | 24 class WebNotificationPresenter; |
25 class WebSecurityOrigin; | 25 class WebSecurityOrigin; |
26 class WebSharedWorker; | 26 class WebSharedWorker; |
27 class WebWorkerContentSettingsClientProxy; | 27 class WebWorkerContentSettingsClientProxy; |
28 } | 28 } |
29 | 29 |
30 namespace content { | 30 namespace content { |
| 31 class MessagePort; |
31 class SharedWorkerDevToolsAgent; | 32 class SharedWorkerDevToolsAgent; |
32 class WebApplicationCacheHostImpl; | 33 class WebApplicationCacheHostImpl; |
33 class WebMessagePortChannelImpl; | 34 class WebMessagePortChannelImpl; |
34 | 35 |
35 // A stub class to receive IPC from browser process and talk to | 36 // A stub class to receive IPC from browser process and talk to |
36 // blink::WebSharedWorker. Implements blink::WebSharedWorkerClient. | 37 // blink::WebSharedWorker. Implements blink::WebSharedWorkerClient. |
37 // This class is self-destruct (no one explicitly owns this), and | 38 // This class is self-destruct (no one explicitly owns this), and |
38 // deletes itself (via private Shutdown() method) when either one of | 39 // deletes itself (via private Shutdown() method) when either one of |
39 // following methods is called by blink::WebSharedWorker: | 40 // following methods is called by blink::WebSharedWorker: |
40 // - workerScriptLoadFailed() or | 41 // - workerScriptLoadFailed() or |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* | 82 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* |
82 createDevToolsMessageLoop() override; | 83 createDevToolsMessageLoop() override; |
83 | 84 |
84 private: | 85 private: |
85 ~EmbeddedSharedWorkerStub() override; | 86 ~EmbeddedSharedWorkerStub() override; |
86 | 87 |
87 void Shutdown(); | 88 void Shutdown(); |
88 bool Send(IPC::Message* message); | 89 bool Send(IPC::Message* message); |
89 | 90 |
90 // WebSharedWorker will own |channel|. | 91 // WebSharedWorker will own |channel|. |
91 void ConnectToChannel(WebMessagePortChannelImpl* channel); | 92 void ConnectToChannel(int connection_request_id, |
| 93 std::unique_ptr<WebMessagePortChannelImpl> channel); |
92 | 94 |
93 void OnConnect(int sent_message_port_id, int routing_id); | 95 void OnConnect(int connection_request_id, |
| 96 const MessagePort& sent_message_port); |
94 void OnTerminateWorkerContext(); | 97 void OnTerminateWorkerContext(); |
95 | 98 |
96 int route_id_; | 99 int route_id_; |
97 base::string16 name_; | 100 base::string16 name_; |
98 bool running_ = false; | 101 bool running_ = false; |
99 GURL url_; | 102 GURL url_; |
100 blink::WebSharedWorker* impl_ = nullptr; | 103 blink::WebSharedWorker* impl_ = nullptr; |
101 std::unique_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; | 104 std::unique_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; |
102 | 105 |
103 typedef std::vector<WebMessagePortChannelImpl*> PendingChannelList; | 106 using PendingChannel = std::pair<int /* connection_request_id */, |
104 PendingChannelList pending_channels_; | 107 std::unique_ptr<WebMessagePortChannelImpl>>; |
| 108 std::vector<PendingChannel> pending_channels_; |
105 | 109 |
106 ScopedChildProcessReference process_ref_; | 110 ScopedChildProcessReference process_ref_; |
107 WebApplicationCacheHostImpl* app_cache_host_ = nullptr; | 111 WebApplicationCacheHostImpl* app_cache_host_ = nullptr; |
108 DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerStub); | 112 DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerStub); |
109 }; | 113 }; |
110 | 114 |
111 } // namespace content | 115 } // namespace content |
112 | 116 |
113 #endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ | 117 #endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ |
OLD | NEW |