| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/optional.h" | 12 #include "base/optional.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 14 #include "mojo/public/cpp/bindings/bindings_export.h" | 14 #include "mojo/public/cpp/bindings/bindings_export.h" |
| 15 #include "mojo/public/cpp/bindings/disconnect_reason.h" | 15 #include "mojo/public/cpp/bindings/disconnect_reason.h" |
| 16 #include "mojo/public/cpp/bindings/interface_id.h" | 16 #include "mojo/public/cpp/bindings/interface_id.h" |
| 17 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" | 17 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 | 20 |
| 21 class AssociatedGroup; | 21 class AssociatedGroup; |
| 22 class InterfaceEndpointClient; | 22 class InterfaceEndpointClient; |
| 23 class InterfaceEndpointController; | 23 class InterfaceEndpointController; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 bool is_local, | 47 bool is_local, |
| 48 const base::Optional<DisconnectReason>& reason) = 0; | 48 const base::Optional<DisconnectReason>& reason) = 0; |
| 49 | 49 |
| 50 // Attaches a client to the specified endpoint to send and receive messages. | 50 // Attaches a client to the specified endpoint to send and receive messages. |
| 51 // The returned object is still owned by the controller. It must only be used | 51 // The returned object is still owned by the controller. It must only be used |
| 52 // on the same thread as this call, and only before the client is detached | 52 // on the same thread as this call, and only before the client is detached |
| 53 // using DetachEndpointClient(). | 53 // using DetachEndpointClient(). |
| 54 virtual InterfaceEndpointController* AttachEndpointClient( | 54 virtual InterfaceEndpointController* AttachEndpointClient( |
| 55 const ScopedInterfaceEndpointHandle& handle, | 55 const ScopedInterfaceEndpointHandle& handle, |
| 56 InterfaceEndpointClient* endpoint_client, | 56 InterfaceEndpointClient* endpoint_client, |
| 57 scoped_refptr<base::SingleThreadTaskRunner> runner) = 0; | 57 scoped_refptr<base::SequencedTaskRunner> runner) = 0; |
| 58 | 58 |
| 59 // Detaches the client attached to the specified endpoint. It must be called | 59 // Detaches the client attached to the specified endpoint. It must be called |
| 60 // on the same thread as the corresponding AttachEndpointClient() call. | 60 // on the same thread as the corresponding AttachEndpointClient() call. |
| 61 virtual void DetachEndpointClient( | 61 virtual void DetachEndpointClient( |
| 62 const ScopedInterfaceEndpointHandle& handle) = 0; | 62 const ScopedInterfaceEndpointHandle& handle) = 0; |
| 63 | 63 |
| 64 // Raises an error on the underlying message pipe. It disconnects the pipe | 64 // Raises an error on the underlying message pipe. It disconnects the pipe |
| 65 // and notifies all interfaces running on this pipe. | 65 // and notifies all interfaces running on this pipe. |
| 66 virtual void RaiseError() = 0; | 66 virtual void RaiseError() = 0; |
| 67 | 67 |
| 68 std::unique_ptr<AssociatedGroup> CreateAssociatedGroup(); | 68 std::unique_ptr<AssociatedGroup> CreateAssociatedGroup(); |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 friend class base::RefCountedThreadSafe<AssociatedGroupController>; | 71 friend class base::RefCountedThreadSafe<AssociatedGroupController>; |
| 72 | 72 |
| 73 // Creates a new ScopedInterfaceEndpointHandle associated with this | 73 // Creates a new ScopedInterfaceEndpointHandle associated with this |
| 74 // controller. | 74 // controller. |
| 75 ScopedInterfaceEndpointHandle CreateScopedInterfaceEndpointHandle( | 75 ScopedInterfaceEndpointHandle CreateScopedInterfaceEndpointHandle( |
| 76 InterfaceId id, | 76 InterfaceId id, |
| 77 bool is_local); | 77 bool is_local); |
| 78 | 78 |
| 79 virtual ~AssociatedGroupController(); | 79 virtual ~AssociatedGroupController(); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace mojo | 82 } // namespace mojo |
| 83 | 83 |
| 84 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ | 84 #endif // MOJO_PUBLIC_CPP_BINDINGS_ASSOCIATED_GROUP_CONTROLLER_H_ |
| OLD | NEW |