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 (!main_thread_task_runner_->BelongsToCurrentThread()) { | 158 if (!main_thread_task_runner_->BelongsToCurrentThread()) { |
159 main_thread_task_runner_->PostTask( | 159 main_thread_task_runner_->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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 279 |
278 Release(); | 280 Release(); |
279 ChildProcess::current()->ReleaseProcess(); | 281 ChildProcess::current()->ReleaseProcess(); |
280 } | 282 } |
281 | 283 |
282 WebMessagePortChannelImpl::Message::Message() {} | 284 WebMessagePortChannelImpl::Message::Message() {} |
283 | 285 |
284 WebMessagePortChannelImpl::Message::~Message() {} | 286 WebMessagePortChannelImpl::Message::~Message() {} |
285 | 287 |
286 } // namespace content | 288 } // namespace content |
OLD | NEW |