Index: mojo/public/cpp/bindings/lib/multiplex_router.h |
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.h b/mojo/public/cpp/bindings/lib/multiplex_router.h |
index 9f0de154d3670c9e6508b77e6e38cb4cbc820f92..afd7090310cc91053cbcc99ef1356abccdd9a3df 100644 |
--- a/mojo/public/cpp/bindings/lib/multiplex_router.h |
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.h |
@@ -15,13 +15,13 @@ |
#include "base/logging.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
-#include "base/memory/ref_counted_delete_on_message_loop.h" |
#include "base/memory/weak_ptr.h" |
#include "base/single_thread_task_runner.h" |
#include "base/synchronization/lock.h" |
#include "base/threading/thread_checker.h" |
+#include "mojo/public/cpp/bindings/associated_group_controller.h" |
+#include "mojo/public/cpp/bindings/interface_id.h" |
#include "mojo/public/cpp/bindings/lib/connector.h" |
-#include "mojo/public/cpp/bindings/lib/interface_id.h" |
#include "mojo/public/cpp/bindings/lib/message_header_validator.h" |
#include "mojo/public/cpp/bindings/lib/pipe_control_message_handler.h" |
#include "mojo/public/cpp/bindings/lib/pipe_control_message_handler_delegate.h" |
@@ -38,9 +38,6 @@ class AssociatedGroup; |
namespace internal { |
-class InterfaceEndpointClient; |
-class InterfaceEndpointController; |
- |
// MultiplexRouter supports routing messages for multiple interfaces over a |
// single message pipe. |
// |
@@ -52,7 +49,7 @@ class InterfaceEndpointController; |
// comments for more details. |
class MultiplexRouter |
: public MessageReceiver, |
- public base::RefCountedDeleteOnMessageLoop<MultiplexRouter>, |
+ public AssociatedGroupController, |
public PipeControlMessageHandlerDelegate { |
public: |
// If |set_interface_id_namespace_bit| is true, the interface IDs generated by |
@@ -68,42 +65,20 @@ class MultiplexRouter |
// --------------------------------------------------------------------------- |
// The following public methods are safe to call from any threads. |
- // Creates a pair of interface endpoint handles. The method generates a new |
- // interface ID and assigns it to the two handles. |local_endpoint| is used |
- // locally; while |remote_endpoint| is sent over the message pipe. |
- void CreateEndpointHandlePair(ScopedInterfaceEndpointHandle* local_endpoint, |
- ScopedInterfaceEndpointHandle* remote_endpoint); |
- |
- // Creates an interface endpoint handle from a given interface ID. The handle |
- // is used locally. |
- // Typically, this method is used to (1) create an endpoint handle for the |
- // master interface; or (2) create an endpoint handle on receiving an |
- // interface ID from the message pipe. |
- ScopedInterfaceEndpointHandle CreateLocalEndpointHandle(InterfaceId id); |
- |
- // Closes an interface endpoint handle. |
- void CloseEndpointHandle(InterfaceId id, bool is_local); |
- |
- // Attaches a client to the specified endpoint to send and receive messages. |
- // The returned object is still owned by the router. It must only be used on |
- // the same thread as this call, and only before the client is detached using |
- // DetachEndpointClient(). |
+ // AssociatedGroupController implementation: |
+ void CreateEndpointHandlePair( |
+ ScopedInterfaceEndpointHandle* local_endpoint, |
+ ScopedInterfaceEndpointHandle* remote_endpoint) override; |
+ ScopedInterfaceEndpointHandle CreateLocalEndpointHandle( |
+ InterfaceId id) override; |
+ void CloseEndpointHandle(InterfaceId id, bool is_local) override; |
InterfaceEndpointController* AttachEndpointClient( |
const ScopedInterfaceEndpointHandle& handle, |
InterfaceEndpointClient* endpoint_client, |
- scoped_refptr<base::SingleThreadTaskRunner> runner); |
- |
- // Detaches the client attached to the specified endpoint. It must be called |
- // on the same thread as the corresponding AttachEndpointClient() call. |
- void DetachEndpointClient(const ScopedInterfaceEndpointHandle& handle); |
- |
- // Raises an error on the underlying message pipe. It disconnects the pipe |
- // and notifies all interfaces running on this pipe. |
- void RaiseError(); |
- |
- std::unique_ptr<AssociatedGroup> CreateAssociatedGroup(); |
- |
- static MultiplexRouter* GetRouter(AssociatedGroup* associated_group); |
+ scoped_refptr<base::SingleThreadTaskRunner> runner) override; |
+ void DetachEndpointClient( |
+ const ScopedInterfaceEndpointHandle& handle) override; |
+ void RaiseError() override; |
// --------------------------------------------------------------------------- |
// The following public methods are called on the creating thread. |
@@ -157,9 +132,6 @@ class MultiplexRouter |
} |
private: |
- friend class base::RefCountedDeleteOnMessageLoop<MultiplexRouter>; |
- friend class base::DeleteHelper<MultiplexRouter>; |
- |
class InterfaceEndpoint; |
struct Task; |