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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual bool tryGetMessage(blink::WebString* message, | 51 virtual bool tryGetMessage(blink::WebString* message, |
52 blink::WebMessagePortChannelArray& channels); | 52 blink::WebMessagePortChannelArray& channels); |
53 | 53 |
54 void Init(); | 54 void Init(); |
55 void Entangle(scoped_refptr<WebMessagePortChannelImpl> channel); | 55 void Entangle(scoped_refptr<WebMessagePortChannelImpl> channel); |
56 void Send(IPC::Message* message); | 56 void Send(IPC::Message* message); |
57 | 57 |
58 // IPC::Listener implementation. | 58 // IPC::Listener implementation. |
59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
60 | 60 |
61 void OnMessage(const string16& message, | 61 void OnMessage(const base::string16& message, |
62 const std::vector<int>& sent_message_port_ids, | 62 const std::vector<int>& sent_message_port_ids, |
63 const std::vector<int>& new_routing_ids); | 63 const std::vector<int>& new_routing_ids); |
64 void OnMessagesQueued(); | 64 void OnMessagesQueued(); |
65 | 65 |
66 struct Message { | 66 struct Message { |
67 Message(); | 67 Message(); |
68 ~Message(); | 68 ~Message(); |
69 | 69 |
70 string16 message; | 70 base::string16 message; |
71 std::vector<WebMessagePortChannelImpl*> ports; | 71 std::vector<WebMessagePortChannelImpl*> ports; |
72 }; | 72 }; |
73 | 73 |
74 typedef std::queue<Message> MessageQueue; | 74 typedef std::queue<Message> MessageQueue; |
75 MessageQueue message_queue_; | 75 MessageQueue message_queue_; |
76 | 76 |
77 blink::WebMessagePortChannelClient* client_; | 77 blink::WebMessagePortChannelClient* client_; |
78 base::Lock lock_; // Locks access to above. | 78 base::Lock lock_; // Locks access to above. |
79 | 79 |
80 int route_id_; // The routing id for this object. | 80 int route_id_; // The routing id for this object. |
81 int message_port_id_; // A globally unique identifier for this message port. | 81 int message_port_id_; // A globally unique identifier for this message port. |
82 scoped_refptr<base::MessageLoopProxy> child_thread_loop_; | 82 scoped_refptr<base::MessageLoopProxy> child_thread_loop_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); | 84 DISALLOW_COPY_AND_ASSIGN(WebMessagePortChannelImpl); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace content | 87 } // namespace content |
88 | 88 |
89 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ | 89 #endif // CONTENT_CHILD_WEBMESSAGEPORTCHANNEL_IMPL_H_ |
OLD | NEW |