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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* | 81 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* |
81 createDevToolsMessageLoop() override; | 82 createDevToolsMessageLoop() override; |
82 | 83 |
83 private: | 84 private: |
84 ~EmbeddedSharedWorkerStub() override; | 85 ~EmbeddedSharedWorkerStub() override; |
85 | 86 |
86 void Shutdown(); | 87 void Shutdown(); |
87 bool Send(IPC::Message* message); | 88 bool Send(IPC::Message* message); |
88 | 89 |
89 // WebSharedWorker will own |channel|. | 90 // WebSharedWorker will own |channel|. |
90 void ConnectToChannel(WebMessagePortChannelImpl* channel); | 91 void ConnectToChannel(int connection_request_id, |
| 92 std::unique_ptr<WebMessagePortChannelImpl> channel); |
91 | 93 |
92 void OnConnect(int sent_message_port_id, int routing_id); | 94 void OnConnect(int connection_request_id, |
| 95 const MessagePort& sent_message_port); |
93 void OnTerminateWorkerContext(); | 96 void OnTerminateWorkerContext(); |
94 | 97 |
95 int route_id_; | 98 int route_id_; |
96 base::string16 name_; | 99 base::string16 name_; |
97 bool running_ = false; | 100 bool running_ = false; |
98 GURL url_; | 101 GURL url_; |
99 blink::WebSharedWorker* impl_ = nullptr; | 102 blink::WebSharedWorker* impl_ = nullptr; |
100 std::unique_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; | 103 std::unique_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; |
101 | 104 |
102 typedef std::vector<WebMessagePortChannelImpl*> PendingChannelList; | 105 using PendingChannel = std::pair<int /* connection_request_id */, |
103 PendingChannelList pending_channels_; | 106 std::unique_ptr<WebMessagePortChannelImpl>>; |
| 107 std::vector<PendingChannel> pending_channels_; |
104 | 108 |
105 ScopedChildProcessReference process_ref_; | 109 ScopedChildProcessReference process_ref_; |
106 WebApplicationCacheHostImpl* app_cache_host_ = nullptr; | 110 WebApplicationCacheHostImpl* app_cache_host_ = nullptr; |
107 DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerStub); | 111 DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerStub); |
108 }; | 112 }; |
109 | 113 |
110 } // namespace content | 114 } // namespace content |
111 | 115 |
112 #endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ | 116 #endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H_ |
OLD | NEW |