Commit e5c2775c authored by morrita@chromium.org's avatar morrita@chromium.org

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
parent fa5f474c
......@@ -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 {
......
......@@ -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);
}
......
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