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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (MessageLoop::current() != ChildThread::current()->message_loop()) { | 173 if (MessageLoop::current() != ChildThread::current()->message_loop()) { |
174 DCHECK(!message->is_sync()); | 174 DCHECK(!message->is_sync()); |
175 ChildThread::current()->message_loop()->PostTask(FROM_HERE, | 175 ChildThread::current()->message_loop()->PostTask(FROM_HERE, |
176 NewRunnableMethod(this, &WebMessagePortChannelImpl::Send, message)); | 176 NewRunnableMethod(this, &WebMessagePortChannelImpl::Send, message)); |
177 return; | 177 return; |
178 } | 178 } |
179 | 179 |
180 ChildThread::current()->Send(message); | 180 ChildThread::current()->Send(message); |
181 } | 181 } |
182 | 182 |
183 void WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { | 183 bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { |
| 184 bool handled = true; |
184 IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) | 185 IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) |
185 IPC_MESSAGE_HANDLER(WorkerProcessMsg_Message, OnMessage) | 186 IPC_MESSAGE_HANDLER(WorkerProcessMsg_Message, OnMessage) |
186 IPC_MESSAGE_HANDLER(WorkerProcessMsg_MessagesQueued, OnMessagedQueued) | 187 IPC_MESSAGE_HANDLER(WorkerProcessMsg_MessagesQueued, OnMessagedQueued) |
| 188 IPC_MESSAGE_UNHANDLED(handled = false) |
187 IPC_END_MESSAGE_MAP() | 189 IPC_END_MESSAGE_MAP() |
| 190 return handled; |
188 } | 191 } |
189 | 192 |
190 void WebMessagePortChannelImpl::OnMessage( | 193 void WebMessagePortChannelImpl::OnMessage( |
191 const string16& message, | 194 const string16& message, |
192 const std::vector<int>& sent_message_port_ids, | 195 const std::vector<int>& sent_message_port_ids, |
193 const std::vector<int>& new_routing_ids) { | 196 const std::vector<int>& new_routing_ids) { |
194 AutoLock auto_lock(lock_); | 197 AutoLock auto_lock(lock_); |
195 Message msg; | 198 Message msg; |
196 msg.message = message; | 199 msg.message = message; |
197 if (!sent_message_port_ids.empty()) { | 200 if (!sent_message_port_ids.empty()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 235 |
233 message_port_id_ = MSG_ROUTING_NONE; | 236 message_port_id_ = MSG_ROUTING_NONE; |
234 | 237 |
235 Release(); | 238 Release(); |
236 ChildProcess::current()->ReleaseProcess(); | 239 ChildProcess::current()->ReleaseProcess(); |
237 } | 240 } |
238 | 241 |
239 WebMessagePortChannelImpl::Message::Message() {} | 242 WebMessagePortChannelImpl::Message::Message() {} |
240 | 243 |
241 WebMessagePortChannelImpl::Message::~Message() {} | 244 WebMessagePortChannelImpl::Message::~Message() {} |
OLD | NEW |