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 10 matching lines...) Expand all Loading... |
21 // Implementation of the WebSharedWorker APIs. This object is intended to only | 21 // Implementation of the WebSharedWorker APIs. This object is intended to only |
22 // live long enough to allow the caller to send a "connect" event to the worker | 22 // live long enough to allow the caller to send a "connect" event to the worker |
23 // thread. Once the connect event has been sent, all future communication will | 23 // thread. Once the connect event has been sent, all future communication will |
24 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will | 24 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will |
25 // be freed. | 25 // be freed. |
26 class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector, | 26 class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector, |
27 private IPC::Listener { | 27 private IPC::Listener { |
28 public: | 28 public: |
29 // If the worker not loaded yet, route_id == MSG_ROUTING_NONE | 29 // If the worker not loaded yet, route_id == MSG_ROUTING_NONE |
30 WebSharedWorkerProxy(MessageRouter* router, | 30 WebSharedWorkerProxy(MessageRouter* router, |
31 unsigned long long document_id, | 31 int route_id); |
32 int route_id, | |
33 int render_frame_route_id); | |
34 ~WebSharedWorkerProxy() override; | 32 ~WebSharedWorkerProxy() override; |
35 | 33 |
36 // Implementations of WebSharedWorkerConnector APIs | 34 // Implementations of WebSharedWorkerConnector APIs |
37 void connect(blink::WebMessagePortChannel* channel, | 35 void connect(blink::WebMessagePortChannel* channel, |
38 ConnectListener* listener) override; | 36 ConnectListener* listener) override; |
39 | 37 |
40 private: | 38 private: |
41 // IPC::Listener implementation. | 39 // IPC::Listener implementation. |
42 bool OnMessageReceived(const IPC::Message& message) override; | 40 bool OnMessageReceived(const IPC::Message& message) override; |
43 | 41 |
(...skipping 13 matching lines...) Expand all Loading... |
57 void OnWorkerCreated(); | 55 void OnWorkerCreated(); |
58 void OnWorkerScriptLoadFailed(); | 56 void OnWorkerScriptLoadFailed(); |
59 void OnWorkerConnected(); | 57 void OnWorkerConnected(); |
60 | 58 |
61 // Routing id associated with this worker - used to receive messages from the | 59 // Routing id associated with this worker - used to receive messages from the |
62 // worker, and also to route messages to the worker (WorkerService contains | 60 // worker, and also to route messages to the worker (WorkerService contains |
63 // a map that maps between these renderer-side route IDs and worker-side | 61 // a map that maps between these renderer-side route IDs and worker-side |
64 // routing ids). | 62 // routing ids). |
65 int route_id_; | 63 int route_id_; |
66 | 64 |
67 // The routing id for the RenderFrame that created this worker. | |
68 int render_frame_route_id_; | |
69 | |
70 MessageRouter* const router_; | 65 MessageRouter* const router_; |
71 | 66 |
72 // ID of our parent document (used to shutdown workers when the parent | |
73 // document is detached). | |
74 unsigned long long document_id_; | |
75 | |
76 // Stores messages that were sent before the StartWorkerContext message. | 67 // Stores messages that were sent before the StartWorkerContext message. |
77 std::vector<IPC::Message*> queued_messages_; | 68 std::vector<IPC::Message*> queued_messages_; |
78 | 69 |
79 // The id for the placeholder worker instance we've stored on the | |
80 // browser process (we need to pass this same route id back in when creating | |
81 // the worker). | |
82 int pending_route_id_; | |
83 ConnectListener* connect_listener_; | 70 ConnectListener* connect_listener_; |
84 bool created_; | 71 bool created_; |
85 | 72 |
86 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 73 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
87 }; | 74 }; |
88 | 75 |
89 } // namespace content | 76 } // namespace content |
90 | 77 |
91 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 78 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
OLD | NEW |