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

Side by Side Diff: mojo/public/cpp/bindings/interface_ptr.h

Issue 2280483002: Add FlushForTesting to InterfacePtr and Binding. (Closed)
Patch Set: Created 4 years, 3 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 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // end of the message pipe asynchronously. This does nothing if it's already 107 // end of the message pipe asynchronously. This does nothing if it's already
108 // known that the remote side supports the specified version, i.e., if 108 // known that the remote side supports the specified version, i.e., if
109 // |version <= this->version()|. 109 // |version <= this->version()|.
110 // 110 //
111 // After calling RequireVersion() with a version not supported by the remote 111 // After calling RequireVersion() with a version not supported by the remote
112 // side, all subsequent calls to interface methods will be ignored. 112 // side, all subsequent calls to interface methods will be ignored.
113 void RequireVersion(uint32_t version) { 113 void RequireVersion(uint32_t version) {
114 internal_state_.RequireVersion(version); 114 internal_state_.RequireVersion(version);
115 } 115 }
116 116
117 // Sends a no-op message on the underlying message pipe and runs the current
118 // message loop until its response is received. This can be used in tests to
119 // verify that no message was sent on a message pipe in response to some
120 // stimulus.
121 void FlushForTesting() { internal_state_.FlushForTesting(); }
122
117 // Closes the bound message pipe (if any) and returns the pointer to the 123 // Closes the bound message pipe (if any) and returns the pointer to the
118 // unbound state. 124 // unbound state.
119 void reset() { 125 void reset() {
120 State doomed; 126 State doomed;
121 internal_state_.Swap(&doomed); 127 internal_state_.Swap(&doomed);
122 } 128 }
123 129
124 // Whether there are any associated interfaces running on the pipe currently. 130 // Whether there are any associated interfaces running on the pipe currently.
125 bool HasAssociatedInterfaces() const { 131 bool HasAssociatedInterfaces() const {
126 return internal_state_.HasAssociatedInterfaces(); 132 return internal_state_.HasAssociatedInterfaces();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 base::ThreadTaskRunnerHandle::Get()) { 229 base::ThreadTaskRunnerHandle::Get()) {
224 InterfacePtr<Interface> ptr; 230 InterfacePtr<Interface> ptr;
225 if (info.is_valid()) 231 if (info.is_valid())
226 ptr.Bind(std::move(info), std::move(runner)); 232 ptr.Bind(std::move(info), std::move(runner));
227 return std::move(ptr); 233 return std::move(ptr);
228 } 234 }
229 235
230 } // namespace mojo 236 } // namespace mojo
231 237
232 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ 238 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_endpoint_client.h ('k') | mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698