| OLD | NEW |
| 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_WEBSHAREDWORKER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
| 6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ~WebSharedWorkerProxy() override; | 32 ~WebSharedWorkerProxy() override; |
| 33 | 33 |
| 34 // Implementations of WebSharedWorkerConnector APIs | 34 // Implementations of WebSharedWorkerConnector APIs |
| 35 void connect(blink::WebMessagePortChannel* channel, | 35 void connect(blink::WebMessagePortChannel* channel, |
| 36 ConnectListener* listener) override; | 36 ConnectListener* listener) override; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // IPC::Listener implementation. | 39 // IPC::Listener implementation. |
| 40 bool OnMessageReceived(const IPC::Message& message) override; | 40 bool OnMessageReceived(const IPC::Message& message) override; |
| 41 | 41 |
| 42 // Sends a message to the worker thread (forwarded via the RenderViewHost). | |
| 43 // If WorkerStarted() has not yet been called, message is queued. | |
| 44 bool Send(std::unique_ptr<IPC::Message> message); | |
| 45 | |
| 46 // Sends any messages currently in the queue. | |
| 47 void SendQueuedMessages(); | |
| 48 | |
| 49 void OnWorkerCreated(); | 42 void OnWorkerCreated(); |
| 50 void OnWorkerScriptLoadFailed(); | 43 void OnWorkerScriptLoadFailed(); |
| 51 void OnWorkerConnected(); | 44 void OnWorkerConnected(); |
| 52 | 45 |
| 53 // 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 |
| 54 // worker, and also to route messages to the worker (WorkerService contains | 47 // worker, and also to route messages to the worker (WorkerService contains |
| 55 // 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 |
| 56 // routing ids). | 49 // routing ids). |
| 57 const int route_id_; | 50 const int route_id_; |
| 58 | 51 |
| 59 IPC::MessageRouter* const router_; | 52 IPC::MessageRouter* const router_; |
| 60 | 53 |
| 61 // Stores messages that were sent before the StartWorkerContext message. | 54 std::unique_ptr<IPC::Message> queued_connect_message_; |
| 62 std::vector<std::unique_ptr<IPC::Message>> queued_messages_; | |
| 63 | |
| 64 ConnectListener* connect_listener_; | 55 ConnectListener* connect_listener_; |
| 65 bool created_; | 56 bool created_; |
| 66 | 57 |
| 67 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 58 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
| 68 }; | 59 }; |
| 69 | 60 |
| 70 } // namespace content | 61 } // namespace content |
| 71 | 62 |
| 72 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 63 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
| OLD | NEW |