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

Side by Side Diff: mojo/public/cpp/bindings/interface_ptr.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_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void reset() { 119 void reset() {
120 State doomed; 120 State doomed;
121 internal_state_.Swap(&doomed); 121 internal_state_.Swap(&doomed);
122 } 122 }
123 123
124 // Whether there are any associated interfaces running on the pipe currently. 124 // Whether there are any associated interfaces running on the pipe currently.
125 bool HasAssociatedInterfaces() const { 125 bool HasAssociatedInterfaces() const {
126 return internal_state_.HasAssociatedInterfaces(); 126 return internal_state_.HasAssociatedInterfaces();
127 } 127 }
128 128
129 // Blocks the current thread until the next incoming response callback arrives
130 // or an error occurs. Returns |true| if a response arrived, or |false| in
131 // case of error.
132 //
133 // This method may only be called if the InterfacePtr has been bound to a
134 // message pipe and there are no associated interfaces running.
135 bool WaitForIncomingResponse() {
136 CHECK(!HasAssociatedInterfaces());
137 return internal_state_.WaitForIncomingResponse();
138 }
139
140 // Indicates whether the message pipe has encountered an error. If true, 129 // Indicates whether the message pipe has encountered an error. If true,
141 // method calls made on this interface will be dropped (and may already have 130 // method calls made on this interface will be dropped (and may already have
142 // been dropped). 131 // been dropped).
143 bool encountered_error() const { return internal_state_.encountered_error(); } 132 bool encountered_error() const { return internal_state_.encountered_error(); }
144 133
145 // Registers a handler to receive error notifications. The handler will be 134 // Registers a handler to receive error notifications. The handler will be
146 // called from the thread that owns this InterfacePtr. 135 // called from the thread that owns this InterfacePtr.
147 // 136 //
148 // This method may only be called after the InterfacePtr has been bound to a 137 // This method may only be called after the InterfacePtr has been bound to a
149 // message pipe. 138 // message pipe.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 base::ThreadTaskRunnerHandle::Get()) { 223 base::ThreadTaskRunnerHandle::Get()) {
235 InterfacePtr<Interface> ptr; 224 InterfacePtr<Interface> ptr;
236 if (info.is_valid()) 225 if (info.is_valid())
237 ptr.Bind(std::move(info), std::move(runner)); 226 ptr.Bind(std::move(info), std::move(runner));
238 return std::move(ptr); 227 return std::move(ptr);
239 } 228 }
240 229
241 } // namespace mojo 230 } // namespace mojo
242 231
243 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ 232 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
OLDNEW
« no previous file with comments | « mash/catalog_viewer/catalog_viewer.cc ('k') | mojo/public/cpp/bindings/lib/interface_ptr_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698