OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 #ifdef IPC_MESSAGE_LOG_ENABLED | 251 #ifdef IPC_MESSAGE_LOG_ENABLED |
252 if (message.type() == IPC_LOGGING_ID) { | 252 if (message.type() == IPC_LOGGING_ID) { |
253 logger->OnReceivedLoggingMessage(message); | 253 logger->OnReceivedLoggingMessage(message); |
254 return; | 254 return; |
255 } | 255 } |
256 | 256 |
257 if (logger->Enabled()) | 257 if (logger->Enabled()) |
258 logger->OnPreDispatchMessage(message); | 258 logger->OnPreDispatchMessage(message); |
259 #endif | 259 #endif |
260 | 260 |
261 listener_->OnMessageReceived(message); | 261 bool handled = listener_->OnMessageReceived(message); |
262 | |
263 // Prevent non-handled synchronous messages to deadlock waiting for a reply. | |
joth
2013/01/18 01:37:08
uber-nit: this is not strictly always going to res
Leandro Graciá Gil
2013/01/18 18:53:03
Comment removed when creating a separate private m
| |
264 if (!handled && message.is_sync()) { | |
Leandro Graciá Gil
2013/01/18 01:31:24
Should this also happen in other places returning
Leandro Graciá Gil
2013/01/18 18:53:03
Done.
| |
265 Message* reply = SyncMessage::GenerateReply(&message); | |
266 reply->set_reply_error(); | |
267 ipc_task_runner()->PostTask( | |
268 FROM_HERE, | |
269 base::Bind(&ChannelProxy::Context::OnSendMessage, | |
270 this, base::Passed(scoped_ptr<Message>(reply)))); | |
271 } | |
joth
2013/01/18 01:37:08
this seems pretty reasonable to me, FWIW, but I'd
Leandro Graciá Gil
2013/01/18 18:53:03
We can if either you or John have a strong opinion
| |
262 | 272 |
263 #ifdef IPC_MESSAGE_LOG_ENABLED | 273 #ifdef IPC_MESSAGE_LOG_ENABLED |
264 if (logger->Enabled()) | 274 if (logger->Enabled()) |
265 logger->OnPostDispatchMessage(message, channel_id_); | 275 logger->OnPostDispatchMessage(message, channel_id_); |
266 #endif | 276 #endif |
267 } | 277 } |
268 | 278 |
269 // Called on the listener's thread | 279 // Called on the listener's thread |
270 void ChannelProxy::Context::OnDispatchConnected() { | 280 void ChannelProxy::Context::OnDispatchConnected() { |
271 if (channel_connected_called_) | 281 if (channel_connected_called_) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 Channel* channel = context_.get()->channel_.get(); | 430 Channel* channel = context_.get()->channel_.get(); |
421 // Channel must have been created first. | 431 // Channel must have been created first. |
422 DCHECK(channel) << context_.get()->channel_id_; | 432 DCHECK(channel) << context_.get()->channel_id_; |
423 return channel->GetClientEuid(client_euid); | 433 return channel->GetClientEuid(client_euid); |
424 } | 434 } |
425 #endif | 435 #endif |
426 | 436 |
427 //----------------------------------------------------------------------------- | 437 //----------------------------------------------------------------------------- |
428 | 438 |
429 } // namespace IPC | 439 } // namespace IPC |
OLD | NEW |