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

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

Issue 2096293002: Eliminate usage of InterfacePtr::WaitForIncomingResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybots failure Created 4 years, 5 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_LIB_INTERFACE_PTR_STATE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> // For |std::swap()|. 10 #include <algorithm> // For |std::swap()|.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 DCHECK_EQ(0u, version_); 101 DCHECK_EQ(0u, version_);
102 DCHECK(info.is_valid()); 102 DCHECK(info.is_valid());
103 103
104 handle_ = info.PassHandle(); 104 handle_ = info.PassHandle();
105 version_ = info.version(); 105 version_ = info.version();
106 runner_ = std::move(runner); 106 runner_ = std::move(runner);
107 } 107 }
108 108
109 bool HasAssociatedInterfaces() const { return false; } 109 bool HasAssociatedInterfaces() const { return false; }
110 110
111 bool WaitForIncomingResponse() {
112 ConfigureProxyIfNecessary();
113
114 DCHECK(router_);
115 return router_->WaitForIncomingMessage(MOJO_DEADLINE_INDEFINITE);
116 }
117
118 // After this method is called, the object is in an invalid state and 111 // After this method is called, the object is in an invalid state and
119 // shouldn't be reused. 112 // shouldn't be reused.
120 InterfacePtrInfo<Interface> PassInterface() { 113 InterfacePtrInfo<Interface> PassInterface() {
121 return InterfacePtrInfo<Interface>( 114 return InterfacePtrInfo<Interface>(
122 router_ ? router_->PassMessagePipe() : std::move(handle_), version_); 115 router_ ? router_->PassMessagePipe() : std::move(handle_), version_);
123 } 116 }
124 117
125 bool is_bound() const { return handle_.is_valid() || router_; } 118 bool is_bound() const { return handle_.is_valid() || router_; }
126 119
127 bool encountered_error() const { 120 bool encountered_error() const {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 251
259 handle_ = info.PassHandle(); 252 handle_ = info.PassHandle();
260 version_ = info.version(); 253 version_ = info.version();
261 runner_ = std::move(runner); 254 runner_ = std::move(runner);
262 } 255 }
263 256
264 bool HasAssociatedInterfaces() const { 257 bool HasAssociatedInterfaces() const {
265 return router_ ? router_->HasAssociatedEndpoints() : false; 258 return router_ ? router_->HasAssociatedEndpoints() : false;
266 } 259 }
267 260
268 bool WaitForIncomingResponse() {
269 ConfigureProxyIfNecessary();
270
271 DCHECK(router_);
272 return router_->WaitForIncomingMessage(MOJO_DEADLINE_INDEFINITE);
273 }
274
275 // After this method is called, the object is in an invalid state and 261 // After this method is called, the object is in an invalid state and
276 // shouldn't be reused. 262 // shouldn't be reused.
277 InterfacePtrInfo<Interface> PassInterface() { 263 InterfacePtrInfo<Interface> PassInterface() {
278 endpoint_client_.reset(); 264 endpoint_client_.reset();
279 proxy_.reset(); 265 proxy_.reset();
280 return InterfacePtrInfo<Interface>( 266 return InterfacePtrInfo<Interface>(
281 router_ ? router_->PassMessagePipe() : std::move(handle_), version_); 267 router_ ? router_->PassMessagePipe() : std::move(handle_), version_);
282 } 268 }
283 269
284 bool is_bound() const { return handle_.is_valid() || endpoint_client_; } 270 bool is_bound() const { return handle_.is_valid() || endpoint_client_; }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 339
354 uint32_t version_; 340 uint32_t version_;
355 341
356 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState); 342 DISALLOW_COPY_AND_ASSIGN(InterfacePtrState);
357 }; 343 };
358 344
359 } // namespace internal 345 } // namespace internal
360 } // namespace mojo 346 } // namespace mojo
361 347
362 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_ 348 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_INTERFACE_PTR_STATE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698