From 21a249e4d9cb0b2ec6f0ff84ed5f7939ea67ac52 Mon Sep 17 00:00:00 2001 From: Luis Hector Chavez Date: Wed, 26 Jul 2017 17:38:05 +0000 Subject: Revert "libmojo: Uprev the library to r456626 from Chromium" This reverts commit 8ac9103e05b66812c25348943383f9365d1ce3e0. Reason for revert: Broke the mac_sdk Exempt-From-Owner-Approval: Fixing mac_sdk Change-Id: I0b74d1abaa66933a93fd6f82ff018e8948c1204e --- .../cpp/bindings/associated_group_controller.h | 60 ++++++++++------------ 1 file changed, 26 insertions(+), 34 deletions(-) (limited to 'mojo/public/cpp/bindings/associated_group_controller.h') diff --git a/mojo/public/cpp/bindings/associated_group_controller.h b/mojo/public/cpp/bindings/associated_group_controller.h index d33c277..0ab8253 100644 --- a/mojo/public/cpp/bindings/associated_group_controller.h +++ b/mojo/public/cpp/bindings/associated_group_controller.h @@ -9,47 +9,41 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/optional.h" +#include "base/memory/ref_counted_delete_on_message_loop.h" #include "base/single_thread_task_runner.h" -#include "mojo/public/cpp/bindings/bindings_export.h" -#include "mojo/public/cpp/bindings/disconnect_reason.h" #include "mojo/public/cpp/bindings/interface_id.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" namespace mojo { +class AssociatedGroup; class InterfaceEndpointClient; class InterfaceEndpointController; -// An internal interface used to manage endpoints within an associated group, -// which corresponds to one end of a message pipe. -class MOJO_CPP_BINDINGS_EXPORT AssociatedGroupController - : public base::RefCountedThreadSafe { +// An internal interface used to manage endpoints within an associated group. +class AssociatedGroupController : + public base::RefCountedDeleteOnMessageLoop { public: - // Associates an interface with this AssociatedGroupController's message pipe. - // It takes ownership of |handle_to_send| and returns an interface ID that - // could be sent by any endpoints within the same associated group. - // If |handle_to_send| is not in pending association state, it returns - // kInvalidInterfaceId. Otherwise, the peer handle of |handle_to_send| joins - // the associated group and is no longer pending. - virtual InterfaceId AssociateInterface( - ScopedInterfaceEndpointHandle handle_to_send) = 0; + explicit AssociatedGroupController( + scoped_refptr task_runner); + + // 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. + virtual void CreateEndpointHandlePair( + ScopedInterfaceEndpointHandle* local_endpoint, + ScopedInterfaceEndpointHandle* remote_endpoint) = 0; // Creates an interface endpoint handle from a given interface ID. The handle - // joins this associated group. + // 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. - // - // On failure, the method returns an invalid handle. Usually that is because - // the ID has already been used to create a handle. virtual ScopedInterfaceEndpointHandle CreateLocalEndpointHandle( InterfaceId id) = 0; // Closes an interface endpoint handle. - virtual void CloseEndpointHandle( - InterfaceId id, - const base::Optional& reason) = 0; + virtual void CloseEndpointHandle(InterfaceId id, bool is_local) = 0; // Attaches a client to the specified endpoint to send and receive messages. // The returned object is still owned by the controller. It must only be used @@ -69,23 +63,21 @@ class MOJO_CPP_BINDINGS_EXPORT AssociatedGroupController // and notifies all interfaces running on this pipe. virtual void RaiseError() = 0; + std::unique_ptr CreateAssociatedGroup(); + protected: - friend class base::RefCountedThreadSafe; + friend class base::RefCountedDeleteOnMessageLoop; + friend class base::DeleteHelper; - // Creates a new ScopedInterfaceEndpointHandle within this associated group. + // Creates a new ScopedInterfaceEndpointHandle associated with this + // controller. ScopedInterfaceEndpointHandle CreateScopedInterfaceEndpointHandle( - InterfaceId id); - - // Notifies that the interface represented by |handle_to_send| and its peer - // has been associated with this AssociatedGroupController's message pipe, and - // |handle_to_send|'s peer has joined this associated group. (Note: it is the - // peer who has joined the associated group; |handle_to_send| will be sent to - // the remote side.) - // Returns false if |handle_to_send|'s peer has closed. - bool NotifyAssociation(ScopedInterfaceEndpointHandle* handle_to_send, - InterfaceId id); + InterfaceId id, + bool is_local); virtual ~AssociatedGroupController(); + + DISALLOW_COPY_AND_ASSIGN(AssociatedGroupController); }; } // namespace mojo -- cgit v1.2.3