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 { ...@@ -22,7 +22,8 @@ namespace {
class ListenerThatExpectsOK : public IPC::Listener { class ListenerThatExpectsOK : public IPC::Listener {
public: public:
ListenerThatExpectsOK() {} ListenerThatExpectsOK()
: received_ok_(false) {}
virtual ~ListenerThatExpectsOK() {} virtual ~ListenerThatExpectsOK() {}
...@@ -31,12 +32,16 @@ class ListenerThatExpectsOK : public IPC::Listener { ...@@ -31,12 +32,16 @@ class ListenerThatExpectsOK : public IPC::Listener {
std::string should_be_ok; std::string should_be_ok;
EXPECT_TRUE(iter.ReadString(&should_be_ok)); EXPECT_TRUE(iter.ReadString(&should_be_ok));
EXPECT_EQ(should_be_ok, "OK"); EXPECT_EQ(should_be_ok, "OK");
received_ok_ = true;
base::MessageLoop::current()->Quit(); base::MessageLoop::current()->Quit();
return true; return true;
} }
virtual void OnChannelError() OVERRIDE { 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) { static void SendOK(IPC::Sender* sender) {
...@@ -45,6 +50,9 @@ class ListenerThatExpectsOK : public IPC::Listener { ...@@ -45,6 +50,9 @@ class ListenerThatExpectsOK : public IPC::Listener {
message->WriteString(std::string("OK")); message->WriteString(std::string("OK"));
ASSERT_TRUE(sender->Send(message)); ASSERT_TRUE(sender->Send(message));
} }
private:
bool received_ok_;
}; };
class ListenerThatShouldBeNeverCalled : public IPC::Listener { class ListenerThatShouldBeNeverCalled : public IPC::Listener {
......
...@@ -67,11 +67,11 @@ void MessagePipeReader::PipeIsReady(MojoResult wait_result) { ...@@ -67,11 +67,11 @@ void MessagePipeReader::PipeIsReady(MojoResult wait_result) {
pipe_wait_id_ = 0; pipe_wait_id_ = 0;
if (wait_result != MOJO_RESULT_OK) { if (wait_result != MOJO_RESULT_OK) {
// FAILED_PRECONDITION happens when the pipe is if (wait_result != MOJO_RESULT_ABORTED) {
// closed before the waiter is scheduled in a backend thread. // FAILED_PRECONDITION happens every time the peer is dead so
if (wait_result != MOJO_RESULT_ABORTED && // it isn't worth polluting the log message.
wait_result != MOJO_RESULT_FAILED_PRECONDITION) { DLOG_IF(WARNING, wait_result != MOJO_RESULT_FAILED_PRECONDITION)
DLOG(WARNING) << "Pipe got error from the waiter. Closing: " << "Pipe got error from the waiter. Closing: "
<< wait_result; << wait_result;
OnPipeError(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