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

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

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: . Created 3 years, 9 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/connector.h ('k') | mojo/public/cpp/bindings/lib/binding_state.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 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 9
10 #include <string> 10 #include <string>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 bool Equals(const InterfacePtr& other) const { 187 bool Equals(const InterfacePtr& other) const {
188 if (this == &other) 188 if (this == &other)
189 return true; 189 return true;
190 190
191 // Now that the two refer to different objects, they are equivalent if 191 // Now that the two refer to different objects, they are equivalent if
192 // and only if they are both null. 192 // and only if they are both null.
193 return !(*this) && !other; 193 return !(*this) && !other;
194 } 194 }
195 195
196 void EnableNestedDispatch(bool enabled) {
197 internal_state_.EnableNestedDispatch(enabled);
198 }
199
196 // DO NOT USE. Exposed only for internal use and for testing. 200 // DO NOT USE. Exposed only for internal use and for testing.
197 internal::InterfacePtrState<Interface>* internal_state() { 201 internal::InterfacePtrState<Interface>* internal_state() {
198 return &internal_state_; 202 return &internal_state_;
199 } 203 }
200 204
201 // Allow InterfacePtr<> to be used in boolean expressions, but not 205 // Allow InterfacePtr<> to be used in boolean expressions, but not
202 // implicitly convertible to a real bool (which is dangerous). 206 // implicitly convertible to a real bool (which is dangerous).
203 private: 207 private:
204 // TODO(dcheng): Use an explicit conversion operator. 208 // TODO(dcheng): Use an explicit conversion operator.
205 typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable; 209 typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable;
(...skipping 27 matching lines...) Expand all
233 base::ThreadTaskRunnerHandle::Get()) { 237 base::ThreadTaskRunnerHandle::Get()) {
234 InterfacePtr<Interface> ptr; 238 InterfacePtr<Interface> ptr;
235 if (info.is_valid()) 239 if (info.is_valid())
236 ptr.Bind(std::move(info), std::move(runner)); 240 ptr.Bind(std::move(info), std::move(runner));
237 return std::move(ptr); 241 return std::move(ptr);
238 } 242 }
239 243
240 } // namespace mojo 244 } // namespace mojo
241 245
242 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ 246 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/connector.h ('k') | mojo/public/cpp/bindings/lib/binding_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698