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