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

Side by Side Diff: mojo/public/cpp/bindings/associated_binding.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
« no previous file with comments | « mojo/public/cpp/bindings/README.md ('k') | mojo/public/cpp/bindings/associated_interface_ptr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ASSOCIATED_BINDING_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void Close(); 46 void Close();
47 47
48 // Similar to the method above, but also specifies a disconnect reason. 48 // Similar to the method above, but also specifies a disconnect reason.
49 void CloseWithReason(uint32_t custom_reason, const std::string& description); 49 void CloseWithReason(uint32_t custom_reason, const std::string& description);
50 50
51 // Sets an error handler that will be called if a connection error occurs. 51 // Sets an error handler that will be called if a connection error occurs.
52 // 52 //
53 // This method may only be called after this AssociatedBinding has been bound 53 // This method may only be called after this AssociatedBinding has been bound
54 // to a message pipe. The error handler will be reset when this 54 // to a message pipe. The error handler will be reset when this
55 // AssociatedBinding is unbound or closed. 55 // AssociatedBinding is unbound or closed.
56 void set_connection_error_handler(const base::Closure& error_handler); 56 void set_connection_error_handler(base::OnceClosure error_handler);
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 60
61 // Indicates whether the associated binding has been completed. 61 // Indicates whether the associated binding has been completed.
62 bool is_bound() const { return !!endpoint_client_; } 62 bool is_bound() const { return !!endpoint_client_; }
63 63
64 // Sends a message on the underlying message pipe and runs the current 64 // Sends a message on the underlying message pipe and runs the current
65 // message loop until its response is received. This can be used in tests to 65 // message loop until its response is received. This can be used in tests to
66 // verify that no message was sent on a message pipe in response to some 66 // verify that no message was sent on a message pipe in response to some
67 // stimulus. 67 // stimulus.
68 void FlushForTesting(); 68 void FlushForTesting();
69 69
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 private: 140 private:
141 typename Interface::template Stub_<ImplRefTraits> stub_; 141 typename Interface::template Stub_<ImplRefTraits> stub_;
142 142
143 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); 143 DISALLOW_COPY_AND_ASSIGN(AssociatedBinding);
144 }; 144 };
145 145
146 } // namespace mojo 146 } // namespace mojo
147 147
148 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_ 148 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_BINDING_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/README.md ('k') | mojo/public/cpp/bindings/associated_interface_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698