| 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 e760c7d34a053bf9ec57d9386dd15ecab1f12f63..5d83e48103c70227349c12c55900e684a63df9fd 100644
|
| --- a/mojo/public/cpp/bindings/associated_interface_ptr.h
|
| +++ b/mojo/public/cpp/bindings/associated_interface_ptr.h
|
| @@ -204,7 +204,7 @@ class AssociatedInterfacePtr {
|
|
|
| // Creates an associated interface. The output |ptr| should be used locally
|
| // while the returned request should be passed through the message pipe endpoint
|
| -// referred to by |associated_group| to setup the corresponding asssociated
|
| +// referred to by |associated_group| to setup the corresponding associated
|
| // interface implementation at the remote side.
|
| //
|
| // NOTE: |ptr| should NOT be used to make calls before the request is sent.
|
| @@ -255,16 +255,41 @@ AssociatedInterfaceRequest<Interface> MakeRequestForTesting(
|
| return request;
|
| }
|
|
|
| -// Creates an associated interface proxy which casts its messages into the void.
|
| +// Like |GetProxy|, but the interface is never associated with any other
|
| +// interface. The returned request can be bound directly to the corresponding
|
| +// associated interface implementation, without first passing it through a
|
| +// message pipe endpoint.
|
| +//
|
| +// This function has two main uses:
|
| +//
|
| +// * In testing, where the returned request is bound to e.g. a mock and there
|
| +// are no other interfaces involved.
|
| +//
|
| +// * When discarding messages sent on an interface, which can be done by
|
| +// discarding the returned request.
|
| template <typename Interface>
|
| -void GetDummyProxyForTesting(AssociatedInterfacePtr<Interface>* proxy) {
|
| +AssociatedInterfaceRequest<Interface> GetIsolatedProxy(
|
| + AssociatedInterfacePtr<Interface>* ptr) {
|
| MessagePipe pipe;
|
| - scoped_refptr<internal::MultiplexRouter> router =
|
| + scoped_refptr<internal::MultiplexRouter> router0 =
|
| new internal::MultiplexRouter(std::move(pipe.handle0),
|
| internal::MultiplexRouter::MULTI_INTERFACE,
|
| false, base::ThreadTaskRunnerHandle::Get());
|
| - std::unique_ptr<AssociatedGroup> group = router->CreateAssociatedGroup();
|
| - MakeRequest(proxy, group.get());
|
| + scoped_refptr<internal::MultiplexRouter> router1 =
|
| + new internal::MultiplexRouter(std::move(pipe.handle1),
|
| + internal::MultiplexRouter::MULTI_INTERFACE,
|
| + true, base::ThreadTaskRunnerHandle::Get());
|
| +
|
| + ScopedInterfaceEndpointHandle endpoint0, endpoint1;
|
| + router0->CreateEndpointHandlePair(&endpoint0, &endpoint1);
|
| + endpoint1 = router1->CreateLocalEndpointHandle(endpoint1.release());
|
| +
|
| + ptr->Bind(AssociatedInterfacePtrInfo<Interface>(std::move(endpoint0),
|
| + Interface::Version_));
|
| +
|
| + AssociatedInterfaceRequest<Interface> request;
|
| + request.Bind(std::move(endpoint1));
|
| + return request;
|
| }
|
|
|
| } // namespace mojo
|
|
|