OLD | NEW |
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 <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/error_handler.h" | 10 #include "mojo/public/cpp/bindings/error_handler.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 State doomed; | 108 State doomed; |
109 internal_state_.Swap(&doomed); | 109 internal_state_.Swap(&doomed); |
110 } | 110 } |
111 | 111 |
112 // Blocks the current thread until the next incoming response callback arrives | 112 // Blocks the current thread until the next incoming response callback arrives |
113 // or an error occurs. Returns |true| if a response arrived, or |false| in | 113 // or an error occurs. Returns |true| if a response arrived, or |false| in |
114 // case of error. | 114 // case of error. |
115 // | 115 // |
116 // This method may only be called after the InterfacePtr has been bound to a | 116 // This method may only be called after the InterfacePtr has been bound to a |
117 // message pipe. | 117 // message pipe. |
118 // | 118 bool WaitForIncomingResponse() { |
119 // TODO(jamesr): Rename to WaitForIncomingResponse(). | 119 return internal_state_.WaitForIncomingResponse(); |
120 bool WaitForIncomingMethodCall() { | |
121 return internal_state_.WaitForIncomingMethodCall(); | |
122 } | 120 } |
123 | 121 |
124 // Indicates whether the message pipe has encountered an error. If true, | 122 // Indicates whether the message pipe has encountered an error. If true, |
125 // method calls made on this interface will be dropped (and may already have | 123 // method calls made on this interface will be dropped (and may already have |
126 // been dropped). | 124 // been dropped). |
127 bool encountered_error() const { return internal_state_.encountered_error(); } | 125 bool encountered_error() const { return internal_state_.encountered_error(); } |
128 | 126 |
129 // Registers a handler to receive error notifications. The handler will be | 127 // Registers a handler to receive error notifications. The handler will be |
130 // called from the thread that owns this InterfacePtr. | 128 // called from the thread that owns this InterfacePtr. |
131 // | 129 // |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { | 173 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
176 InterfacePtr<Interface> ptr; | 174 InterfacePtr<Interface> ptr; |
177 if (info.is_valid()) | 175 if (info.is_valid()) |
178 ptr.Bind(info.Pass(), waiter); | 176 ptr.Bind(info.Pass(), waiter); |
179 return ptr.Pass(); | 177 return ptr.Pass(); |
180 } | 178 } |
181 | 179 |
182 } // namespace mojo | 180 } // namespace mojo |
183 | 181 |
184 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 182 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
OLD | NEW |