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 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/files/scoped_file.h" | 15 #include "base/files/scoped_file.h" |
| 16 #include "base/memory/ref_counted.h" |
16 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 18 #include "base/single_thread_task_runner.h" |
17 #include "build/build_config.h" | 19 #include "build/build_config.h" |
18 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
19 #include "ipc/ipc_endpoint.h" | 21 #include "ipc/ipc_endpoint.h" |
20 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
21 #include "mojo/public/cpp/bindings/associated_group.h" | 23 #include "mojo/public/cpp/bindings/associated_group.h" |
22 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 24 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
23 #include "mojo/public/cpp/bindings/associated_interface_request.h" | 25 #include "mojo/public/cpp/bindings/associated_interface_request.h" |
24 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" | 26 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
25 | 27 |
26 #if defined(OS_POSIX) | 28 #if defined(OS_POSIX) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Adds an interface factory to this channel for interface |name|. | 115 // Adds an interface factory to this channel for interface |name|. |
114 virtual void AddGenericAssociatedInterface( | 116 virtual void AddGenericAssociatedInterface( |
115 const std::string& name, | 117 const std::string& name, |
116 const GenericAssociatedInterfaceFactory& factory) = 0; | 118 const GenericAssociatedInterfaceFactory& factory) = 0; |
117 | 119 |
118 // Requests an associated interface from the remote endpoint. | 120 // Requests an associated interface from the remote endpoint. |
119 virtual void GetGenericRemoteAssociatedInterface( | 121 virtual void GetGenericRemoteAssociatedInterface( |
120 const std::string& name, | 122 const std::string& name, |
121 mojo::ScopedInterfaceEndpointHandle handle) = 0; | 123 mojo::ScopedInterfaceEndpointHandle handle) = 0; |
122 | 124 |
| 125 // Sets the TaskRunner on which to support proxied dispatch for associated |
| 126 // interfaces. |
| 127 virtual void SetProxyTaskRunner( |
| 128 scoped_refptr<base::SingleThreadTaskRunner> task_runner) = 0; |
| 129 |
123 // Template helper to add an interface factory to this channel. | 130 // Template helper to add an interface factory to this channel. |
124 template <typename Interface> | 131 template <typename Interface> |
125 using AssociatedInterfaceFactory = | 132 using AssociatedInterfaceFactory = |
126 base::Callback<void(mojo::AssociatedInterfaceRequest<Interface>)>; | 133 base::Callback<void(mojo::AssociatedInterfaceRequest<Interface>)>; |
127 template <typename Interface> | 134 template <typename Interface> |
128 void AddAssociatedInterface( | 135 void AddAssociatedInterface( |
129 const AssociatedInterfaceFactory<Interface>& factory) { | 136 const AssociatedInterfaceFactory<Interface>& factory) { |
130 AddGenericAssociatedInterface( | 137 AddGenericAssociatedInterface( |
131 Interface::Name_, | 138 Interface::Name_, |
132 base::Bind(&BindAssociatedInterfaceRequest<Interface>, factory)); | 139 base::Bind(&BindAssociatedInterfaceRequest<Interface>, factory)); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 356 |
350 #if defined(OS_POSIX) | 357 #if defined(OS_POSIX) |
351 // SocketPair() creates a pair of socket FDs suitable for using with | 358 // SocketPair() creates a pair of socket FDs suitable for using with |
352 // IPC::Channel. | 359 // IPC::Channel. |
353 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 360 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
354 #endif | 361 #endif |
355 | 362 |
356 } // namespace IPC | 363 } // namespace IPC |
357 | 364 |
358 #endif // IPC_IPC_CHANNEL_H_ | 365 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |