| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 DCHECK(0 == num_handles || handle_buffer_.size() == num_handles); | 145 DCHECK(0 == num_handles || handle_buffer_.size() == num_handles); |
| 146 return result; | 146 return result; |
| 147 } | 147 } |
| 148 | 148 |
| 149 void MessagePipeReader::ReadAvailableMessages() { | 149 void MessagePipeReader::ReadAvailableMessages() { |
| 150 while (pipe_.is_valid()) { | 150 while (pipe_.is_valid()) { |
| 151 MojoResult read_result = ReadMessageBytes(); | 151 MojoResult read_result = ReadMessageBytes(); |
| 152 if (read_result == MOJO_RESULT_SHOULD_WAIT) | 152 if (read_result == MOJO_RESULT_SHOULD_WAIT) |
| 153 break; | 153 break; |
| 154 if (read_result != MOJO_RESULT_OK) { | 154 if (read_result != MOJO_RESULT_OK) { |
| 155 // FAILED_PRECONDITION means that all the received messages | 155 DLOG(WARNING) |
| 156 // got consumed and the peer is already closed. | 156 << "Pipe got error from ReadMessage(). Closing: " << read_result; |
| 157 if (read_result != MOJO_RESULT_FAILED_PRECONDITION) { | 157 OnPipeError(read_result); |
| 158 DLOG(WARNING) | |
| 159 << "Pipe got error from ReadMessage(). Closing: " << read_result; | |
| 160 OnPipeError(read_result); | |
| 161 } | |
| 162 | |
| 163 Close(); | 158 Close(); |
| 164 break; | 159 break; |
| 165 } | 160 } |
| 166 | 161 |
| 167 OnMessageReceived(); | 162 OnMessageReceived(); |
| 168 } | 163 } |
| 169 | 164 |
| 170 } | 165 } |
| 171 | 166 |
| 172 void MessagePipeReader::ReadMessagesThenWait() { | 167 void MessagePipeReader::ReadMessagesThenWait() { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 216 |
| 222 void MessagePipeReader::DelayedDeleter::operator()( | 217 void MessagePipeReader::DelayedDeleter::operator()( |
| 223 MessagePipeReader* ptr) const { | 218 MessagePipeReader* ptr) const { |
| 224 ptr->Close(); | 219 ptr->Close(); |
| 225 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 220 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 226 base::Bind(&DeleteNow, ptr)); | 221 base::Bind(&DeleteNow, ptr)); |
| 227 } | 222 } |
| 228 | 223 |
| 229 } // namespace internal | 224 } // namespace internal |
| 230 } // namespace IPC | 225 } // namespace IPC |
| OLD | NEW |