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_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 5 #ifndef CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
6 #define CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 6 #define CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class WebMessagePortChannelImpl | 26 class WebMessagePortChannelImpl |
27 : public blink::WebMessagePortChannel, | 27 : public blink::WebMessagePortChannel, |
28 public IPC::Listener, | 28 public IPC::Listener, |
29 public base::RefCountedThreadSafe<WebMessagePortChannelImpl> { | 29 public base::RefCountedThreadSafe<WebMessagePortChannelImpl> { |
30 public: | 30 public: |
31 explicit WebMessagePortChannelImpl(base::MessageLoopProxy* child_thread_loop); | 31 explicit WebMessagePortChannelImpl(base::MessageLoopProxy* child_thread_loop); |
32 WebMessagePortChannelImpl(int route_id, | 32 WebMessagePortChannelImpl(int route_id, |
33 int message_port_id, | 33 int message_port_id, |
34 base::MessageLoopProxy* child_thread_loop); | 34 base::MessageLoopProxy* child_thread_loop); |
35 | 35 |
| 36 static void CreatePair(base::MessageLoopProxy* child_thread_loop, |
| 37 blink::WebMessagePortChannel** channel1, |
| 38 blink::WebMessagePortChannel** channel2); |
| 39 |
36 // Extracts port IDs for passing on to the browser process, and queues any | 40 // Extracts port IDs for passing on to the browser process, and queues any |
37 // received messages. Takes ownership of the passed array (and deletes it). | 41 // received messages. Takes ownership of the passed array (and deletes it). |
38 static std::vector<int> ExtractMessagePortIDs( | 42 static std::vector<int> ExtractMessagePortIDs( |
39 blink::WebMessagePortChannelArray* channels); | 43 blink::WebMessagePortChannelArray* channels); |
40 | 44 |
41 // Queues received and incoming messages until there are no more in-flight | 45 // Queues received and incoming messages until there are no more in-flight |
42 // messages, then sends all of them to the browser process. | 46 // messages, then sends all of them to the browser process. |
43 void QueueMessages(); | 47 void QueueMessages(); |
44 int message_port_id() const { return message_port_id_; } | 48 int message_port_id() const { return message_port_id_; } |
45 | 49 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 int route_id_; // The routing id for this object. | 91 int route_id_; // The routing id for this object. |
88 int message_port_id_; // A globally unique identifier for this message port. | 92 int message_port_id_; // A globally unique identifier for this message port. |
89 scoped_refptr<base::MessageLoopProxy> child_thread_loop_; | 93 scoped_refptr<base::MessageLoopProxy> child_thread_loop_; |
90 | 94 |
91 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); | 95 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); |
92 }; | 96 }; |
93 | 97 |
94 } // namespace content | 98 } // namespace content |
95 | 99 |
96 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 100 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
OLD | NEW |