OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/browser/message_port_service.h" | 5 #include "content/browser/message_port_service.h" |
6 | 6 |
7 #include "content/browser/message_port_message_filter.h" | 7 #include "content/browser/message_port_message_filter.h" |
8 #include "content/common/message_port_messages.h" | 8 #include "content/common/message_port_messages.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 DCHECK(message_ports_[remote_message_port_id].entangled_message_port_id == | 103 DCHECK(message_ports_[remote_message_port_id].entangled_message_port_id == |
104 MSG_ROUTING_NONE); | 104 MSG_ROUTING_NONE); |
105 message_ports_[remote_message_port_id].entangled_message_port_id = | 105 message_ports_[remote_message_port_id].entangled_message_port_id = |
106 local_message_port_id; | 106 local_message_port_id; |
107 } | 107 } |
108 | 108 |
109 void MessagePortService::PostMessage( | 109 void MessagePortService::PostMessage( |
110 int sender_message_port_id, | 110 int sender_message_port_id, |
111 const string16& message, | 111 const base::string16& message, |
112 const std::vector<int>& sent_message_port_ids) { | 112 const std::vector<int>& sent_message_port_ids) { |
113 if (!message_ports_.count(sender_message_port_id)) { | 113 if (!message_ports_.count(sender_message_port_id)) { |
114 NOTREACHED(); | 114 NOTREACHED(); |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 int entangled_message_port_id = | 118 int entangled_message_port_id = |
119 message_ports_[sender_message_port_id].entangled_message_port_id; | 119 message_ports_[sender_message_port_id].entangled_message_port_id; |
120 if (entangled_message_port_id == MSG_ROUTING_NONE) | 120 if (entangled_message_port_id == MSG_ROUTING_NONE) |
121 return; // Process could have crashed. | 121 return; // Process could have crashed. |
122 | 122 |
123 if (!message_ports_.count(entangled_message_port_id)) { | 123 if (!message_ports_.count(entangled_message_port_id)) { |
124 NOTREACHED(); | 124 NOTREACHED(); |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 PostMessageTo(entangled_message_port_id, message, sent_message_port_ids); | 128 PostMessageTo(entangled_message_port_id, message, sent_message_port_ids); |
129 } | 129 } |
130 | 130 |
131 void MessagePortService::PostMessageTo( | 131 void MessagePortService::PostMessageTo( |
132 int message_port_id, | 132 int message_port_id, |
133 const string16& message, | 133 const base::string16& message, |
134 const std::vector<int>& sent_message_port_ids) { | 134 const std::vector<int>& sent_message_port_ids) { |
135 if (!message_ports_.count(message_port_id)) { | 135 if (!message_ports_.count(message_port_id)) { |
136 NOTREACHED(); | 136 NOTREACHED(); |
137 return; | 137 return; |
138 } | 138 } |
139 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { | 139 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { |
140 if (!message_ports_.count(sent_message_port_ids[i])) { | 140 if (!message_ports_.count(sent_message_port_ids[i])) { |
141 NOTREACHED(); | 141 NOTREACHED(); |
142 return; | 142 return; |
143 } | 143 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Do the disentanglement (and be paranoid about the other side existing | 236 // Do the disentanglement (and be paranoid about the other side existing |
237 // just in case something unusual happened during entanglement). | 237 // just in case something unusual happened during entanglement). |
238 if (message_ports_.count(entangled_id)) { | 238 if (message_ports_.count(entangled_id)) { |
239 message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; | 239 message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; |
240 } | 240 } |
241 } | 241 } |
242 message_ports_.erase(erase_item); | 242 message_ports_.erase(erase_item); |
243 } | 243 } |
244 | 244 |
245 } // namespace content | 245 } // namespace content |
OLD | NEW |