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

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

Issue 2500263003: Port messages sent by WebIDBCursorImpl to Mojo. (Closed)
Patch Set: Add missing include. 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_group.h
diff --git a/mojo/public/cpp/bindings/associated_group.h b/mojo/public/cpp/bindings/associated_group.h
index b1c692acd2393cb4052cf33747863122078e28dc..d391fc1b755562c479a82637bd04a69d8dd156b1 100644
--- a/mojo/public/cpp/bindings/associated_group.h
+++ b/mojo/public/cpp/bindings/associated_group.h
@@ -11,6 +11,7 @@
#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
#include "mojo/public/cpp/bindings/associated_interface_request.h"
#include "mojo/public/cpp/bindings/bindings_export.h"
+#include "mojo/public/cpp/bindings/lib/multiplex_router.h"
#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
namespace mojo {
@@ -86,6 +87,33 @@ class MOJO_CPP_BINDINGS_EXPORT AssociatedGroup {
scoped_refptr<AssociatedGroupController> controller_;
};
+// Creates an associated interface proxy in its own AssociatedGroup.
+template <typename Interface>
+AssociatedInterfaceRequest<Interface> GetProxyForTesting(
yzshen1 2016/11/15 17:39:50 Does it make sense to: - move this function to ass
Reilly Grant (use Gerrit) 2016/11/15 17:43:11 I tried putting it in associated_interface_ptr_inf
yzshen1 2016/11/15 17:59:35 I meant associated_interface_ptr.h (instead of ass
+ AssociatedInterfacePtrInfo<Interface>* ptr_info,
+ 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);
+
+ 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();
+ CHECK(!handle.is_local());
+ *ptr_info = AssociatedInterfacePtrInfo<Interface>(
+ router0->CreateLocalEndpointHandle(handle.release()),
+ ptr_info->version());
+
+ return request;
+}
+
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_H_
« 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