OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/mojo/ipc_message_pipe_reader.h" | 5 #include "ipc/mojo/ipc_message_pipe_reader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 if (!pipe_wait_id_) | 60 if (!pipe_wait_id_) |
61 return; | 61 return; |
62 mojo::Environment::GetDefaultAsyncWaiter()->CancelWait(pipe_wait_id_); | 62 mojo::Environment::GetDefaultAsyncWaiter()->CancelWait(pipe_wait_id_); |
63 pipe_wait_id_ = 0; | 63 pipe_wait_id_ = 0; |
64 } | 64 } |
65 | 65 |
66 void MessagePipeReader::PipeIsReady(MojoResult wait_result) { | 66 void MessagePipeReader::PipeIsReady(MojoResult wait_result) { |
67 pipe_wait_id_ = 0; | 67 pipe_wait_id_ = 0; |
68 | 68 |
69 if (wait_result != MOJO_RESULT_OK) { | 69 if (wait_result != MOJO_RESULT_OK) { |
70 // FAILED_PRECONDITION happens when the pipe is | 70 if (wait_result != MOJO_RESULT_ABORTED) { |
viettrungluu
2014/08/08 00:36:12
This is fine, but do you ever expect to see MOJO_R
| |
71 // closed before the waiter is scheduled in a backend thread. | 71 // FAILED_PRECONDITION happens every time the peer is dead so |
72 if (wait_result != MOJO_RESULT_ABORTED && | 72 // it isn't worth polluting the log message. |
73 wait_result != MOJO_RESULT_FAILED_PRECONDITION) { | 73 DLOG_IF(WARNING, wait_result != MOJO_RESULT_FAILED_PRECONDITION) |
74 DLOG(WARNING) << "Pipe got error from the waiter. Closing: " | 74 << "Pipe got error from the waiter. Closing: " |
75 << wait_result; | 75 << wait_result; |
76 OnPipeError(wait_result); | 76 OnPipeError(wait_result); |
77 } | 77 } |
78 | 78 |
79 Close(); | 79 Close(); |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 while (pipe_.is_valid()) { | 83 while (pipe_.is_valid()) { |
84 MojoResult read_result = ReadMessageBytes(); | 84 MojoResult read_result = ReadMessageBytes(); |
85 if (read_result == MOJO_RESULT_SHOULD_WAIT) | 85 if (read_result == MOJO_RESULT_SHOULD_WAIT) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 | 135 |
136 void MessagePipeReader::DelayedDeleter::operator()( | 136 void MessagePipeReader::DelayedDeleter::operator()( |
137 MessagePipeReader* ptr) const { | 137 MessagePipeReader* ptr) const { |
138 ptr->Close(); | 138 ptr->Close(); |
139 base::MessageLoopProxy::current()->PostTask( | 139 base::MessageLoopProxy::current()->PostTask( |
140 FROM_HERE, base::Bind(&DeleteNow, ptr)); | 140 FROM_HERE, base::Bind(&DeleteNow, ptr)); |
141 } | 141 } |
142 | 142 |
143 } // namespace internal | 143 } // namespace internal |
144 } // namespace IPC | 144 } // namespace IPC |
OLD | NEW |