diff options
author | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 21:45:13 +0000 |
---|---|---|
committer | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-08 21:46:48 +0000 |
commit | e5c2775c8bdcc27bcc1651a258a1c60ef55d9f69 (patch) | |
tree | 777d57f784309e907d342211d7f68c746d6cb1dd /ipc | |
parent | fa5f474c5b3389be8dd6929d3284ce15ea330504 (diff) | |
download | chromium_src-e5c2775c8bdcc27bcc1651a258a1c60ef55d9f69.zip chromium_src-e5c2775c8bdcc27bcc1651a258a1c60ef55d9f69.tar.gz chromium_src-e5c2775c8bdcc27bcc1651a258a1c60ef55d9f69.tar.bz2 |
IPC::ChannelMojo: Don't supress MOJO_RESULT_FAILED_PRECONDITION
The error should be reported to IPC::Listener as it is a
signal of the dead peer. Without this, the browser cannot
detect renderer crashes.
TEST=browser_tests (with ChannelMojo enabled)
R=viettrungluu@chromium.org,darin@chromium.org
BUG=none
Review URL: https://codereview.chromium.org/453643003
Cr-Commit-Position: refs/heads/master@{#288442}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/mojo/ipc_channel_mojo_unittest.cc | 12 | ||||
-rw-r--r-- | ipc/mojo/ipc_message_pipe_reader.cc | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc index 915029d..3157837 100644 --- a/ipc/mojo/ipc_channel_mojo_unittest.cc +++ b/ipc/mojo/ipc_channel_mojo_unittest.cc @@ -22,7 +22,8 @@ namespace { class ListenerThatExpectsOK : public IPC::Listener { public: - ListenerThatExpectsOK() {} + ListenerThatExpectsOK() + : received_ok_(false) {} virtual ~ListenerThatExpectsOK() {} @@ -31,12 +32,16 @@ class ListenerThatExpectsOK : public IPC::Listener { std::string should_be_ok; EXPECT_TRUE(iter.ReadString(&should_be_ok)); EXPECT_EQ(should_be_ok, "OK"); + received_ok_ = true; base::MessageLoop::current()->Quit(); return true; } virtual void OnChannelError() OVERRIDE { - NOTREACHED(); + // The connection should be healthy while the listener is waiting + // message. An error can occur after that because the peer + // process dies. + DCHECK(received_ok_); } static void SendOK(IPC::Sender* sender) { @@ -45,6 +50,9 @@ class ListenerThatExpectsOK : public IPC::Listener { message->WriteString(std::string("OK")); ASSERT_TRUE(sender->Send(message)); } + + private: + bool received_ok_; }; class ListenerThatShouldBeNeverCalled : public IPC::Listener { diff --git a/ipc/mojo/ipc_message_pipe_reader.cc b/ipc/mojo/ipc_message_pipe_reader.cc index 91022ac..b0df997 100644 --- a/ipc/mojo/ipc_message_pipe_reader.cc +++ b/ipc/mojo/ipc_message_pipe_reader.cc @@ -67,12 +67,12 @@ void MessagePipeReader::PipeIsReady(MojoResult wait_result) { pipe_wait_id_ = 0; if (wait_result != MOJO_RESULT_OK) { - // FAILED_PRECONDITION happens when the pipe is - // closed before the waiter is scheduled in a backend thread. - if (wait_result != MOJO_RESULT_ABORTED && - wait_result != MOJO_RESULT_FAILED_PRECONDITION) { - DLOG(WARNING) << "Pipe got error from the waiter. Closing: " - << wait_result; + if (wait_result != MOJO_RESULT_ABORTED) { + // FAILED_PRECONDITION happens every time the peer is dead so + // it isn't worth polluting the log message. + DLOG_IF(WARNING, wait_result != MOJO_RESULT_FAILED_PRECONDITION) + << "Pipe got error from the waiter. Closing: " + << wait_result; OnPipeError(wait_result); } |