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. | 106 // with this Channel. Must be safe to call from any thread. |
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|. | 109 // Adds an interface factory to this channel for interface |name|. Must be |
| 110 // safe to call from any thread. |
110 virtual void AddGenericAssociatedInterface( | 111 virtual void AddGenericAssociatedInterface( |
111 const std::string& name, | 112 const std::string& name, |
112 const GenericAssociatedInterfaceFactory& factory) = 0; | 113 const GenericAssociatedInterfaceFactory& factory) = 0; |
113 | 114 |
114 // Requests an associated interface from the remote endpoint. | 115 // Requests an associated interface from the remote endpoint. |
115 virtual void GetGenericRemoteAssociatedInterface( | 116 virtual void GetGenericRemoteAssociatedInterface( |
116 const std::string& name, | 117 const std::string& name, |
117 mojo::ScopedInterfaceEndpointHandle handle) = 0; | 118 mojo::ScopedInterfaceEndpointHandle handle) = 0; |
118 | 119 |
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 | |
124 // Template helper to add an interface factory to this channel. | 120 // Template helper to add an interface factory to this channel. |
125 template <typename Interface> | 121 template <typename Interface> |
126 using AssociatedInterfaceFactory = | 122 using AssociatedInterfaceFactory = |
127 base::Callback<void(mojo::AssociatedInterfaceRequest<Interface>)>; | 123 base::Callback<void(mojo::AssociatedInterfaceRequest<Interface>)>; |
128 template <typename Interface> | 124 template <typename Interface> |
129 void AddAssociatedInterface( | 125 void AddAssociatedInterface( |
130 const AssociatedInterfaceFactory<Interface>& factory) { | 126 const AssociatedInterfaceFactory<Interface>& factory) { |
131 AddGenericAssociatedInterface( | 127 AddGenericAssociatedInterface( |
132 Interface::Name_, | 128 Interface::Name_, |
133 base::Bind(&BindAssociatedInterfaceRequest<Interface>, factory)); | 129 base::Bind(&BindAssociatedInterfaceRequest<Interface>, factory)); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 340 |
345 #if defined(OS_POSIX) | 341 #if defined(OS_POSIX) |
346 // SocketPair() creates a pair of socket FDs suitable for using with | 342 // SocketPair() creates a pair of socket FDs suitable for using with |
347 // IPC::Channel. | 343 // IPC::Channel. |
348 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 344 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
349 #endif | 345 #endif |
350 | 346 |
351 } // namespace IPC | 347 } // namespace IPC |
352 | 348 |
353 #endif // IPC_IPC_CHANNEL_H_ | 349 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |