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

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

Issue 1811433002: [mojo-edk] Expose notification source to MojoWatch callbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename Created 4 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
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 // Returns the associated group that this object belongs to. Returns null if: 168 // Returns the associated group that this object belongs to. Returns null if:
169 // - this object is not bound; or 169 // - this object is not bound; or
170 // - the interface doesn't have methods to pass associated interface 170 // - the interface doesn't have methods to pass associated interface
171 // pointers or requests. 171 // pointers or requests.
172 AssociatedGroup* associated_group() { 172 AssociatedGroup* associated_group() {
173 return internal_state_.associated_group(); 173 return internal_state_.associated_group();
174 } 174 }
175 175
176 // Allows immediate, synchronous dispatch of any incoming response callback
177 // elicited by an event on the InterfacePtr's own thread. This is useful for
178 // efficiency when an InterfacePtr lives on the same thread that's running
179 // Mojo IPC Support (e.g. Chrome's IO thread) because there's no risk of an
180 // outgoing method call synchronously (and subtly) invoking its response
181 // callback.
182 //
183 // This may also be used in testing when, e.g., an InterfacePtr and Binding
184 // live on the same thread and you want synchronous behavior for messages that
185 // are asynchronous under normal conditions.
186 //
187 // Note that this option also affects all endpoints which are associated with
188 // this one and which live on the same thread.
189 void EnableImmediateDispatchOfEventsFromSameThread(bool enabled) {
190 internal_state_.EnableImmediateDispatchOfEventsFromSameThread(enabled);
191 }
192
176 // DO NOT USE. Exposed only for internal use and for testing. 193 // DO NOT USE. Exposed only for internal use and for testing.
177 internal::InterfacePtrState<Interface, Interface::PassesAssociatedKinds_>* 194 internal::InterfacePtrState<Interface, Interface::PassesAssociatedKinds_>*
178 internal_state() { 195 internal_state() {
179 return &internal_state_; 196 return &internal_state_;
180 } 197 }
181 198
182 // Allow InterfacePtr<> to be used in boolean expressions, but not 199 // Allow InterfacePtr<> to be used in boolean expressions, but not
183 // implicitly convertible to a real bool (which is dangerous). 200 // implicitly convertible to a real bool (which is dangerous).
184 private: 201 private:
185 typedef internal::InterfacePtrState<Interface, 202 typedef internal::InterfacePtrState<Interface,
(...skipping 25 matching lines...) Expand all
211 InterfacePtr<Interface> MakeProxy(InterfacePtrInfo<Interface> info) { 228 InterfacePtr<Interface> MakeProxy(InterfacePtrInfo<Interface> info) {
212 InterfacePtr<Interface> ptr; 229 InterfacePtr<Interface> ptr;
213 if (info.is_valid()) 230 if (info.is_valid())
214 ptr.Bind(std::move(info)); 231 ptr.Bind(std::move(info));
215 return std::move(ptr); 232 return std::move(ptr);
216 } 233 }
217 234
218 } // namespace mojo 235 } // namespace mojo
219 236
220 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ 237 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698