OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/child/webmessageportchannel_impl.h" | 5 #include "content/child/webmessageportchannel_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
10 #include "content/child/child_thread.h" | 10 #include "content/child/child_thread.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void WebMessagePortChannelImpl::OnMessage( | 204 void WebMessagePortChannelImpl::OnMessage( |
205 const string16& message, | 205 const string16& message, |
206 const std::vector<int>& sent_message_port_ids, | 206 const std::vector<int>& sent_message_port_ids, |
207 const std::vector<int>& new_routing_ids) { | 207 const std::vector<int>& new_routing_ids) { |
208 base::AutoLock auto_lock(lock_); | 208 base::AutoLock auto_lock(lock_); |
209 Message msg; | 209 Message msg; |
210 msg.message = message; | 210 msg.message = message; |
211 if (!sent_message_port_ids.empty()) { | 211 if (!sent_message_port_ids.empty()) { |
212 msg.ports.resize(sent_message_port_ids.size()); | 212 msg.ports.resize(sent_message_port_ids.size()); |
213 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { | 213 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { |
214 msg.ports[i] = new WebMessagePortChannelImpl( | 214 msg.ports[i] = new WebMessagePortChannelImpl(new_routing_ids[i], |
215 new_routing_ids[i], sent_message_port_ids[i], child_thread_loop_); | 215 sent_message_port_ids[i], |
| 216 child_thread_loop_.get()); |
216 } | 217 } |
217 } | 218 } |
218 | 219 |
219 bool was_empty = message_queue_.empty(); | 220 bool was_empty = message_queue_.empty(); |
220 message_queue_.push(msg); | 221 message_queue_.push(msg); |
221 if (client_ && was_empty) | 222 if (client_ && was_empty) |
222 client_->messageAvailable(); | 223 client_->messageAvailable(); |
223 } | 224 } |
224 | 225 |
225 void WebMessagePortChannelImpl::OnMessagedQueued() { | 226 void WebMessagePortChannelImpl::OnMessagedQueued() { |
(...skipping 22 matching lines...) Expand all Loading... |
248 | 249 |
249 Release(); | 250 Release(); |
250 ChildProcess::current()->ReleaseProcess(); | 251 ChildProcess::current()->ReleaseProcess(); |
251 } | 252 } |
252 | 253 |
253 WebMessagePortChannelImpl::Message::Message() {} | 254 WebMessagePortChannelImpl::Message::Message() {} |
254 | 255 |
255 WebMessagePortChannelImpl::Message::~Message() {} | 256 WebMessagePortChannelImpl::Message::~Message() {} |
256 | 257 |
257 } // namespace content | 258 } // namespace content |
OLD | NEW |