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

Unified Diff: mojo/public/cpp/bindings/associated_interface_ptr.h

Issue 2500263003: Port messages sent by WebIDBCursorImpl to Mojo. (Closed)
Patch Set: Address dcheng@'s comments. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/associated_interface_ptr.h
diff --git a/mojo/public/cpp/bindings/associated_interface_ptr.h b/mojo/public/cpp/bindings/associated_interface_ptr.h
index 3bdb319548a379f134ec95e76ec7c6d3d3a0b076..e5c068e2a6fcf8d46a29dc5129a011a17c66497b 100644
--- a/mojo/public/cpp/bindings/associated_interface_ptr.h
+++ b/mojo/public/cpp/bindings/associated_interface_ptr.h
@@ -226,6 +226,35 @@ AssociatedInterfaceRequest<Interface> GetProxy(
return request;
}
+// Creates an associated interface proxy in its own AssociatedGroup.
+template <typename Interface>
+AssociatedInterfaceRequest<Interface> GetProxyForTesting(
+ AssociatedInterfacePtr<Interface>* ptr,
+ scoped_refptr<base::SingleThreadTaskRunner> runner =
+ base::ThreadTaskRunnerHandle::Get()) {
+ MessagePipe pipe;
+ using internal::MultiplexRouter;
+ scoped_refptr<MultiplexRouter> router0 = new MultiplexRouter(
+ std::move(pipe.handle0), MultiplexRouter::MULTI_INTERFACE, true, runner);
+ scoped_refptr<MultiplexRouter> router1 = new MultiplexRouter(
+ std::move(pipe.handle1), MultiplexRouter::MULTI_INTERFACE, false, runner);
+
+ AssociatedInterfacePtrInfo<Interface> ptr_info;
+ AssociatedInterfaceRequest<Interface> request;
+ router1->CreateAssociatedGroup()->CreateAssociatedInterface(
+ AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
+
+ // Emulate passing |ptr_info| across a pipe.
+ ScopedInterfaceEndpointHandle handle = ptr_info.PassHandle();
+ DCHECK(!handle.is_local());
+ ptr->Bind(AssociatedInterfacePtrInfo<Interface>(
+ router0->CreateLocalEndpointHandle(handle.release()),
+ ptr_info.version()),
+ std::move(runner));
+
+ return request;
+}
+
// Creates an associated interface proxy which casts its messages into the void.
template <typename Interface>
void GetDummyProxyForTesting(AssociatedInterfacePtr<Interface>* proxy) {
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698