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

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

Issue 2932193002: Use OnceCallback for Mojo binding connection error handlers. (Closed)
Patch Set: Call Run() on rvalue. Created 3 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
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/connector.h" 5 #include "mojo/public/cpp/bindings/connector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
9 8
10 #include "base/bind.h" 9 #include "base/bind.h"
11 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
12 #include "base/location.h" 11 #include "base/location.h"
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
16 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 16 #include "base/run_loop.h"
18 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 message_pipe_ = std::move(dummy_pipe.handle0); 471 message_pipe_ = std::move(dummy_pipe.handle0);
473 } else { 472 } else {
474 CancelWait(); 473 CancelWait();
475 } 474 }
476 475
477 if (force_async_handler) { 476 if (force_async_handler) {
478 if (!paused_) 477 if (!paused_)
479 WaitToReadMore(); 478 WaitToReadMore();
480 } else { 479 } else {
481 error_ = true; 480 error_ = true;
482 if (!connection_error_handler_.is_null()) 481 if (connection_error_handler_)
483 connection_error_handler_.Run(); 482 std::move(connection_error_handler_).Run();
484 } 483 }
485 } 484 }
486 485
487 void Connector::EnsureSyncWatcherExists() { 486 void Connector::EnsureSyncWatcherExists() {
488 if (sync_watcher_) 487 if (sync_watcher_)
489 return; 488 return;
490 sync_watcher_.reset(new SyncHandleWatcher( 489 sync_watcher_.reset(new SyncHandleWatcher(
491 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, 490 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE,
492 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, 491 base::Bind(&Connector::OnSyncHandleWatcherHandleReady,
493 base::Unretained(this)))); 492 base::Unretained(this))));
494 } 493 }
495 494
496 } // namespace mojo 495 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/binding_state.h ('k') | mojo/public/cpp/bindings/lib/interface_endpoint_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698