| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Release the object on the main thread, since the destructor might want to | 63 // Release the object on the main thread, since the destructor might want to |
| 64 // send an IPC, and that has to happen on the main thread. | 64 // send an IPC, and that has to happen on the main thread. |
| 65 ChildThread::current()->message_loop()->ReleaseSoon(FROM_HERE, this); | 65 ChildThread::current()->message_loop()->ReleaseSoon(FROM_HERE, this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void WebMessagePortChannelImpl::entangle(WebMessagePortChannel* channel) { | 68 void WebMessagePortChannelImpl::entangle(WebMessagePortChannel* channel) { |
| 69 // The message port ids might not be set up yet, if this channel wasn't | 69 // The message port ids might not be set up yet, if this channel wasn't |
| 70 // created on the main thread. So need to wait until we're on the main thread | 70 // created on the main thread. So need to wait until we're on the main thread |
| 71 // before getting the other message port id. | 71 // before getting the other message port id. |
| 72 scoped_refptr<WebMessagePortChannelImpl> webchannel = | 72 scoped_refptr<WebMessagePortChannelImpl> webchannel( |
| 73 static_cast<WebMessagePortChannelImpl*>(channel); | 73 static_cast<WebMessagePortChannelImpl*>(channel)); |
| 74 Entangle(webchannel); | 74 Entangle(webchannel); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void WebMessagePortChannelImpl::postMessage( | 77 void WebMessagePortChannelImpl::postMessage( |
| 78 const WebString& message, | 78 const WebString& message, |
| 79 WebMessagePortChannelArray* channels) { | 79 WebMessagePortChannelArray* channels) { |
| 80 if (MessageLoop::current() != ChildThread::current()->message_loop()) { | 80 if (MessageLoop::current() != ChildThread::current()->message_loop()) { |
| 81 ChildThread::current()->message_loop()->PostTask(FROM_HERE, | 81 ChildThread::current()->message_loop()->PostTask(FROM_HERE, |
| 82 NewRunnableMethod(this, &WebMessagePortChannelImpl::postMessage, | 82 NewRunnableMethod(this, &WebMessagePortChannelImpl::postMessage, |
| 83 message, channels)); | 83 message, channels)); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 message_port_id_ = MSG_ROUTING_NONE; | 233 message_port_id_ = MSG_ROUTING_NONE; |
| 234 | 234 |
| 235 Release(); | 235 Release(); |
| 236 ChildProcess::current()->ReleaseProcess(); | 236 ChildProcess::current()->ReleaseProcess(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 WebMessagePortChannelImpl::Message::Message() {} | 239 WebMessagePortChannelImpl::Message::Message() {} |
| 240 | 240 |
| 241 WebMessagePortChannelImpl::Message::~Message() {} | 241 WebMessagePortChannelImpl::Message::~Message() {} |
| OLD | NEW |