| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
| 6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Helper interface a Channel may implement to expose support for associated | 96 // Helper interface a Channel may implement to expose support for associated |
| 97 // Mojo interfaces. | 97 // Mojo interfaces. |
| 98 class IPC_EXPORT AssociatedInterfaceSupport { | 98 class IPC_EXPORT AssociatedInterfaceSupport { |
| 99 public: | 99 public: |
| 100 using GenericAssociatedInterfaceFactory = | 100 using GenericAssociatedInterfaceFactory = |
| 101 base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>; | 101 base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>; |
| 102 | 102 |
| 103 virtual ~AssociatedInterfaceSupport() {} | 103 virtual ~AssociatedInterfaceSupport() {} |
| 104 | 104 |
| 105 // Accesses the AssociatedGroup used to associate new interface endpoints | 105 // Accesses the AssociatedGroup used to associate new interface endpoints |
| 106 // with this Channel. Must be safe to call from any thread. | 106 // with this Channel. |
| 107 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0; | 107 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0; |
| 108 | 108 |
| 109 // Adds an interface factory to this channel for interface |name|. Must be | 109 // Adds an interface factory to this channel for interface |name|. |
| 110 // safe to call from any thread. | |
| 111 virtual void AddGenericAssociatedInterface( | 110 virtual void AddGenericAssociatedInterface( |
| 112 const std::string& name, | 111 const std::string& name, |
| 113 const GenericAssociatedInterfaceFactory& factory) = 0; | 112 const GenericAssociatedInterfaceFactory& factory) = 0; |
| 114 | 113 |
| 115 // Requests an associated interface from the remote endpoint. | 114 // Requests an associated interface from the remote endpoint. |
| 116 virtual void GetGenericRemoteAssociatedInterface( | 115 virtual void GetGenericRemoteAssociatedInterface( |
| 117 const std::string& name, | 116 const std::string& name, |
| 118 mojo::ScopedInterfaceEndpointHandle handle) = 0; | 117 mojo::ScopedInterfaceEndpointHandle handle) = 0; |
| 119 | 118 |
| 119 // Sets the TaskRunner on which to support proxied dispatch for associated |
| 120 // interfaces. |
| 121 virtual void SetProxyTaskRunner( |
| 122 scoped_refptr<base::SingleThreadTaskRunner> task_runner) = 0; |
| 123 |
| 120 // Template helper to add an interface factory to this channel. | 124 // Template helper to add an interface factory to this channel. |
| 121 template <typename Interface> | 125 template <typename Interface> |
| 122 using AssociatedInterfaceFactory = | 126 using AssociatedInterfaceFactory = |
| 123 base::Callback<void(mojo::AssociatedInterfaceRequest<Interface>)>; | 127 base::Callback<void(mojo::AssociatedInterfaceRequest<Interface>)>; |
| 124 template <typename Interface> | 128 template <typename Interface> |
| 125 void AddAssociatedInterface( | 129 void AddAssociatedInterface( |
| 126 const AssociatedInterfaceFactory<Interface>& factory) { | 130 const AssociatedInterfaceFactory<Interface>& factory) { |
| 127 AddGenericAssociatedInterface( | 131 AddGenericAssociatedInterface( |
| 128 Interface::Name_, | 132 Interface::Name_, |
| 129 base::Bind(&BindAssociatedInterfaceRequest<Interface>, factory)); | 133 base::Bind(&BindAssociatedInterfaceRequest<Interface>, factory)); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 344 |
| 341 #if defined(OS_POSIX) | 345 #if defined(OS_POSIX) |
| 342 // SocketPair() creates a pair of socket FDs suitable for using with | 346 // SocketPair() creates a pair of socket FDs suitable for using with |
| 343 // IPC::Channel. | 347 // IPC::Channel. |
| 344 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 348 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 345 #endif | 349 #endif |
| 346 | 350 |
| 347 } // namespace IPC | 351 } // namespace IPC |
| 348 | 352 |
| 349 #endif // IPC_IPC_CHANNEL_H_ | 353 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |