Index: ipc/ipc_channel_proxy.cc |
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc |
index 0202e9e27ef665d13fe5dc30c01737fe5aaa1106..2fd37553b89654247ae92096300a9897036b536d 100644 |
--- a/ipc/ipc_channel_proxy.cc |
+++ b/ipc/ipc_channel_proxy.cc |
@@ -258,7 +258,17 @@ void ChannelProxy::Context::OnDispatchMessage(const Message& message) { |
logger->OnPreDispatchMessage(message); |
#endif |
- listener_->OnMessageReceived(message); |
+ bool handled = listener_->OnMessageReceived(message); |
+ |
+ // 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
|
+ 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.
|
+ Message* reply = SyncMessage::GenerateReply(&message); |
+ reply->set_reply_error(); |
+ ipc_task_runner()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&ChannelProxy::Context::OnSendMessage, |
+ this, base::Passed(scoped_ptr<Message>(reply)))); |
+ } |
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
|
#ifdef IPC_MESSAGE_LOG_ENABLED |
if (logger->Enabled()) |