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

Side by Side Diff: mojo/public/cpp/bindings/lib/binding_state.h

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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void PauseIncomingMethodCallProcessing(); 44 void PauseIncomingMethodCallProcessing();
45 void ResumeIncomingMethodCallProcessing(); 45 void ResumeIncomingMethodCallProcessing();
46 46
47 bool WaitForIncomingMethodCall( 47 bool WaitForIncomingMethodCall(
48 MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE); 48 MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE);
49 49
50 void Close(); 50 void Close();
51 void CloseWithReason(uint32_t custom_reason, const std::string& description); 51 void CloseWithReason(uint32_t custom_reason, const std::string& description);
52 52
53 void set_connection_error_handler(const base::Closure& error_handler) { 53 void set_connection_error_handler(base::OnceClosure error_handler) {
54 DCHECK(is_bound()); 54 DCHECK(is_bound());
55 endpoint_client_->set_connection_error_handler(error_handler); 55 endpoint_client_->set_connection_error_handler(std::move(error_handler));
56 } 56 }
57 57
58 void set_connection_error_with_reason_handler( 58 void set_connection_error_with_reason_handler(
59 const ConnectionErrorWithReasonCallback& error_handler) { 59 ConnectionErrorWithReasonCallback error_handler) {
60 DCHECK(is_bound()); 60 DCHECK(is_bound());
61 endpoint_client_->set_connection_error_with_reason_handler(error_handler); 61 endpoint_client_->set_connection_error_with_reason_handler(
62 std::move(error_handler));
62 } 63 }
63 64
64 bool is_bound() const { return !!router_; } 65 bool is_bound() const { return !!router_; }
65 66
66 MessagePipeHandle handle() const { 67 MessagePipeHandle handle() const {
67 DCHECK(is_bound()); 68 DCHECK(is_bound());
68 return router_->handle(); 69 return router_->handle();
69 } 70 }
70 71
71 void FlushForTesting(); 72 void FlushForTesting();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 private: 119 private:
119 typename Interface::template Stub_<ImplRefTraits> stub_; 120 typename Interface::template Stub_<ImplRefTraits> stub_;
120 121
121 DISALLOW_COPY_AND_ASSIGN(BindingState); 122 DISALLOW_COPY_AND_ASSIGN(BindingState);
122 }; 123 };
123 124
124 } // namesapce internal 125 } // namesapce internal
125 } // namespace mojo 126 } // namespace mojo
126 127
127 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_ 128 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDING_STATE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698