| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/webmessageportchannel_impl.h" | 5 #include "chrome/common/webmessageportchannel_impl.h" |
| 6 | 6 |
| 7 #include "chrome/common/child_process.h" | 7 #include "chrome/common/child_process.h" |
| 8 #include "chrome/common/child_thread.h" | 8 #include "chrome/common/child_thread.h" |
| 9 #include "chrome/common/worker_messages.h" | 9 #include "chrome/common/worker_messages.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 NewRunnableMethod(this, &WebMessagePortChannelImpl::Entangle, channel)); | 145 NewRunnableMethod(this, &WebMessagePortChannelImpl::Entangle, channel)); |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 | 148 |
| 149 Send(new WorkerProcessHostMsg_Entangle( | 149 Send(new WorkerProcessHostMsg_Entangle( |
| 150 message_port_id_, channel->message_port_id())); | 150 message_port_id_, channel->message_port_id())); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void WebMessagePortChannelImpl::QueueMessages() { | 153 void WebMessagePortChannelImpl::QueueMessages() { |
| 154 // This message port is being sent elsewhere (perhaps to another process). | 154 // This message port is being sent elsewhere (perhaps to another process). |
| 155 // The new endpoint needs to recieve the queued messages, including ones that | 155 // The new endpoint needs to receive the queued messages, including ones that |
| 156 // could still be in-flight. So we tell the browser to queue messages, and it | 156 // could still be in-flight. So we tell the browser to queue messages, and it |
| 157 // sends us an ack, whose receipt we know means that no more messages are | 157 // sends us an ack, whose receipt we know means that no more messages are |
| 158 // in-flight. We then send the queued messages to the browser, which prepends | 158 // in-flight. We then send the queued messages to the browser, which prepends |
| 159 // them to the ones it queued and it sends them to the new endpoint. | 159 // them to the ones it queued and it sends them to the new endpoint. |
| 160 Send(new WorkerProcessHostMsg_QueueMessages(message_port_id_)); | 160 Send(new WorkerProcessHostMsg_QueueMessages(message_port_id_)); |
| 161 | 161 |
| 162 // The process could potentially go away while we're still waiting for | 162 // The process could potentially go away while we're still waiting for |
| 163 // in-flight messages. Ensure it stays alive. | 163 // in-flight messages. Ensure it stays alive. |
| 164 ChildProcess::current()->AddRefProcess(); | 164 ChildProcess::current()->AddRefProcess(); |
| 165 } | 165 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 Send(new WorkerProcessHostMsg_SendQueuedMessages( | 225 Send(new WorkerProcessHostMsg_SendQueuedMessages( |
| 226 message_port_id_, queued_messages)); | 226 message_port_id_, queued_messages)); |
| 227 | 227 |
| 228 message_port_id_ = MSG_ROUTING_NONE; | 228 message_port_id_ = MSG_ROUTING_NONE; |
| 229 | 229 |
| 230 Release(); | 230 Release(); |
| 231 ChildProcess::current()->ReleaseProcess(); | 231 ChildProcess::current()->ReleaseProcess(); |
| 232 } | 232 } |
| OLD | NEW |