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

Side by Side Diff: mojo/public/cpp/bindings/lib/connector.cc

Issue 1557753002: Fix assumption in mojo binding class Connector that message pipes notice the other end's closing sy… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/public/cpp/bindings/lib/connector.h" 5 #include "mojo/public/cpp/bindings/lib/connector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 void Connector::ReadAllAvailableMessages() { 258 void Connector::ReadAllAvailableMessages() {
259 while (!error_) { 259 while (!error_) {
260 MojoResult rv; 260 MojoResult rv;
261 261
262 // Return immediately if |this| was destroyed. Do not touch any members! 262 // Return immediately if |this| was destroyed. Do not touch any members!
263 if (!ReadSingleMessage(&rv)) 263 if (!ReadSingleMessage(&rv))
264 return; 264 return;
265 265
266 if (rv == MOJO_RESULT_SHOULD_WAIT) { 266 if (rv == MOJO_RESULT_SHOULD_WAIT) {
267 WaitToReadMore(); 267 // ReadSingleMessage could end up calling HandleError which resets
268 // message_pipe_ to a dummy one that is closed. The old EDK will see the
269 // that the peer is closed immediately, while the new one is asynchronous
270 // because of thread hops. In that case, there'll still be an async
271 // waiter.
272 if (!async_wait_id_)
273 WaitToReadMore();
268 break; 274 break;
269 } 275 }
270 } 276 }
271 } 277 }
272 278
273 void Connector::CancelWait() { 279 void Connector::CancelWait() {
274 if (!async_wait_id_) 280 if (!async_wait_id_)
275 return; 281 return;
276 282
277 waiter_->CancelWait(async_wait_id_); 283 waiter_->CancelWait(async_wait_id_);
(...skipping 30 matching lines...) Expand all
308 if (!paused_) 314 if (!paused_)
309 WaitToReadMore(); 315 WaitToReadMore();
310 } else { 316 } else {
311 error_ = true; 317 error_ = true;
312 connection_error_handler_.Run(); 318 connection_error_handler_.Run();
313 } 319 }
314 } 320 }
315 321
316 } // namespace internal 322 } // namespace internal
317 } // namespace mojo 323 } // namespace mojo
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