| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (!child_thread_loop_->BelongsToCurrentThread()) { | 158 if (!child_thread_loop_->BelongsToCurrentThread()) { |
| 159 child_thread_loop_->PostTask( | 159 child_thread_loop_->PostTask( |
| 160 FROM_HERE, base::Bind(&WebMessagePortChannelImpl::Init, this)); | 160 FROM_HERE, base::Bind(&WebMessagePortChannelImpl::Init, this)); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 | 163 |
| 164 if (route_id_ == MSG_ROUTING_NONE) { | 164 if (route_id_ == MSG_ROUTING_NONE) { |
| 165 DCHECK(message_port_id_ == MSG_ROUTING_NONE); | 165 DCHECK(message_port_id_ == MSG_ROUTING_NONE); |
| 166 Send(new MessagePortHostMsg_CreateMessagePort( | 166 Send(new MessagePortHostMsg_CreateMessagePort( |
| 167 &route_id_, &message_port_id_)); | 167 &route_id_, &message_port_id_)); |
| 168 } else if (message_port_id_ != MSG_ROUTING_NONE) { |
| 169 Send(new MessagePortHostMsg_ReleaseMessages(message_port_id_)); |
| 168 } | 170 } |
| 169 | 171 |
| 170 ChildThread::current()->GetRouter()->AddRoute(route_id_, this); | 172 ChildThread::current()->GetRouter()->AddRoute(route_id_, this); |
| 171 } | 173 } |
| 172 | 174 |
| 173 void WebMessagePortChannelImpl::Entangle( | 175 void WebMessagePortChannelImpl::Entangle( |
| 174 scoped_refptr<WebMessagePortChannelImpl> channel) { | 176 scoped_refptr<WebMessagePortChannelImpl> channel) { |
| 175 // The message port ids might not be set up yet, if this channel wasn't | 177 // The message port ids might not be set up yet, if this channel wasn't |
| 176 // created on the main thread. So need to wait until we're on the main thread | 178 // created on the main thread. So need to wait until we're on the main thread |
| 177 // before getting the other message port id. | 179 // before getting the other message port id. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 278 |
| 277 Release(); | 279 Release(); |
| 278 ChildProcess::current()->ReleaseProcess(); | 280 ChildProcess::current()->ReleaseProcess(); |
| 279 } | 281 } |
| 280 | 282 |
| 281 WebMessagePortChannelImpl::Message::Message() {} | 283 WebMessagePortChannelImpl::Message::Message() {} |
| 282 | 284 |
| 283 WebMessagePortChannelImpl::Message::~Message() {} | 285 WebMessagePortChannelImpl::Message::~Message() {} |
| 284 | 286 |
| 285 } // namespace content | 287 } // namespace content |
| OLD | NEW |