Commit d1d6f6a5 authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Add a dcheck to warn if someone sends a sync IPC through IPC::ChannelProxy.

Change-Id: Ib6ee2044f8d553bb4e96feab509e0e987976665e
Reviewed-on: https://chromium-review.googlesource.com/575911Reviewed-by: default avatarYuzhu Shen <yzshen@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487568}
parent 6d358e32
......@@ -517,6 +517,12 @@ void ChannelProxy::Close() {
}
bool ChannelProxy::Send(Message* message) {
DCHECK(!message->is_sync()) << "Need to use IPC::SyncChannel";
SendInternal(message);
return true;
}
void ChannelProxy::SendInternal(Message* message) {
DCHECK(did_init_);
// TODO(alexeypa): add DCHECK(CalledOnValidThread()) here. Currently there are
......@@ -535,7 +541,6 @@ bool ChannelProxy::Send(Message* message) {
#endif
context_->Send(message);
return true;
}
void ChannelProxy::AddFilter(MessageFilter* filter) {
......
......@@ -377,9 +377,11 @@ class IPC_EXPORT ChannelProxy : public Sender {
}
#endif
protected:
bool did_init() const { return did_init_; }
// A Send() which doesn't DCHECK if the message is synchronous.
void SendInternal(Message* message);
private:
friend class IpcSecurityTestUtil;
......
......@@ -599,7 +599,7 @@ bool SyncChannel::Send(Message* message) {
"line", IPC_MESSAGE_ID_LINE(message->type()));
#endif
if (!message->is_sync()) {
ChannelProxy::Send(message);
ChannelProxy::SendInternal(message);
return true;
}
......@@ -614,7 +614,7 @@ bool SyncChannel::Send(Message* message) {
return false;
}
ChannelProxy::Send(message);
ChannelProxy::SendInternal(message);
// Wait for reply, or for any other incoming synchronous messages.
// |this| might get deleted, so only call static functions at this point.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment