Index: ipc/ipc_sync_channel.cc |
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc |
index b2e79a86f7363b289330cf53207e1021a801ead6..9e04f61dbca13f740c1fb5e47fea9f26e99aeebd 100644 |
--- a/ipc/ipc_sync_channel.cc |
+++ b/ipc/ipc_sync_channel.cc |
@@ -412,6 +412,9 @@ SyncChannel::SyncChannel( |
bool create_pipe_now, |
WaitableEvent* shutdown_event) |
: ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) { |
+ // The current (listener) thread must be distinct from the IPC thread, or else |
+ // sending synchronous messages will deadlock. |
+ DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get()); |
ChannelProxy::Init(channel_handle, mode, create_pipe_now); |
StartWatching(); |
} |
@@ -421,6 +424,9 @@ SyncChannel::SyncChannel( |
base::SingleThreadTaskRunner* ipc_task_runner, |
WaitableEvent* shutdown_event) |
: ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) { |
+ // The current (listener) thread must be distinct from the IPC thread, or else |
+ // sending synchronous messages will deadlock. |
+ DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get()); |
StartWatching(); |
} |