OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EDK_EMBEDDER_EMBEDDER_H_ | 5 #ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 6 #define MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/shared_memory_handle.h" | 16 #include "base/memory/shared_memory_handle.h" |
17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
19 #include "mojo/edk/embedder/scoped_platform_handle.h" | 19 #include "mojo/edk/embedder/scoped_platform_handle.h" |
20 #include "mojo/edk/system/system_impl_export.h" | 20 #include "mojo/edk/system/system_impl_export.h" |
21 #include "mojo/public/cpp/system/message_pipe.h" | 21 #include "mojo/public/cpp/system/message_pipe.h" |
22 | 22 |
| 23 namespace base { |
| 24 class PortProvider; |
| 25 } |
| 26 |
23 namespace mojo { | 27 namespace mojo { |
24 namespace edk { | 28 namespace edk { |
25 | 29 |
26 class ProcessDelegate; | 30 class ProcessDelegate; |
27 | 31 |
28 // Basic configuration/initialization ------------------------------------------ | 32 // Basic configuration/initialization ------------------------------------------ |
29 | 33 |
30 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| | 34 // |Init()| sets up the basic Mojo system environment, making the |Mojo...()| |
31 // functions available and functional. This is never shut down (except in tests | 35 // functions available and functional. This is never shut down (except in tests |
32 // -- see test_embedder.h). | 36 // -- see test_embedder.h). |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 MOJO_SYSTEM_IMPL_EXPORT void InitIPCSupport( | 135 MOJO_SYSTEM_IMPL_EXPORT void InitIPCSupport( |
132 ProcessDelegate* process_delegate, | 136 ProcessDelegate* process_delegate, |
133 scoped_refptr<base::TaskRunner> io_thread_task_runner); | 137 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
134 | 138 |
135 // Shuts down the subsystem initialized by |InitIPCSupport()|. It be called from | 139 // Shuts down the subsystem initialized by |InitIPCSupport()|. It be called from |
136 // any thread and will attempt to complete shutdown on the I/O thread with which | 140 // any thread and will attempt to complete shutdown on the I/O thread with which |
137 // the system was initialized. Upon completion the ProcessDelegate's | 141 // the system was initialized. Upon completion the ProcessDelegate's |
138 // |OnShutdownComplete()| method is invoked. | 142 // |OnShutdownComplete()| method is invoked. |
139 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); | 143 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); |
140 | 144 |
| 145 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 146 // Set the |base::PortProvider| for this process. Can be called on any thread, |
| 147 // but must be set in the root process before any Mach ports can be transferred. |
| 148 MOJO_SYSTEM_IMPL_EXPORT void SetMachPortProvider( |
| 149 base::PortProvider* port_provider); |
| 150 #endif |
| 151 |
141 // Creates a message pipe over an arbitrary platform channel. The other end of | 152 // Creates a message pipe over an arbitrary platform channel. The other end of |
142 // the channel must also be passed to this function. Either endpoint can be in | 153 // the channel must also be passed to this function. Either endpoint can be in |
143 // any process. | 154 // any process. |
144 // | 155 // |
145 // Note that the channel is only used to negotiate pipe connection, not as the | 156 // Note that the channel is only used to negotiate pipe connection, not as the |
146 // transport for messages on the pipe. | 157 // transport for messages on the pipe. |
147 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | 158 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
148 CreateMessagePipe(ScopedPlatformHandle platform_handle); | 159 CreateMessagePipe(ScopedPlatformHandle platform_handle); |
149 | 160 |
150 // Creates a message pipe from a token. A child embedder must also have this | 161 // Creates a message pipe from a token. A child embedder must also have this |
(...skipping 10 matching lines...) Expand all Loading... |
161 | 172 |
162 // Generates a random ASCII token string for use with CreateParentMessagePipe() | 173 // Generates a random ASCII token string for use with CreateParentMessagePipe() |
163 // and CreateChildMessagePipe() above. The generated token is suitably random so | 174 // and CreateChildMessagePipe() above. The generated token is suitably random so |
164 // as to not have to worry about collisions with other generated tokens. | 175 // as to not have to worry about collisions with other generated tokens. |
165 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); | 176 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); |
166 | 177 |
167 } // namespace edk | 178 } // namespace edk |
168 } // namespace mojo | 179 } // namespace mojo |
169 | 180 |
170 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 181 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
OLD | NEW |