Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ipc/mojo/ipc_message_pipe_reader.cc

Issue 1175083002: ChannelMojo: Make MOJO_RESULT_FAILED_PRECONDITION an error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698