| 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> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // called on the I/O thread (given to |InitIPCSupport()|). This completes | 111 // called on the I/O thread (given to |InitIPCSupport()|). This completes |
| 112 // synchronously and does not result in a call to the process delegate's | 112 // synchronously and does not result in a call to the process delegate's |
| 113 // |OnShutdownComplete()|. | 113 // |OnShutdownComplete()|. |
| 114 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportOnIOThread(); | 114 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportOnIOThread(); |
| 115 | 115 |
| 116 // Like |ShutdownIPCSupportOnIOThread()|, but may be called from any thread, | 116 // Like |ShutdownIPCSupportOnIOThread()|, but may be called from any thread, |
| 117 // signalling shutdown completion via the process delegate's | 117 // signalling shutdown completion via the process delegate's |
| 118 // |OnShutdownComplete()|. | 118 // |OnShutdownComplete()|. |
| 119 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); | 119 MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); |
| 120 | 120 |
| 121 // Creates a message pipe over an arbitrary platform channel. The other end of | 121 // Unused. Crashes. Only here for linking. |
| 122 // the channel must also be passed to this function. Either endpoint can be in | |
| 123 // any process. | |
| 124 // | |
| 125 // Note that the channel is only used to negotiate pipe connection, not as the | |
| 126 // transport for messages on the pipe. | |
| 127 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | 122 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
| 128 CreateMessagePipe(ScopedPlatformHandle platform_handle); | 123 CreateMessagePipe(ScopedPlatformHandle platform_handle); |
| 129 | 124 |
| 130 // Creates a message pipe over an arbitrary platform channel. In order for this | 125 // Creates a message pipe over an arbitrary platform channel. In order for this |
| 131 // to work properly each end of the channel must be passed to this function: one | 126 // to work properly each end of the channel must be passed to this function: one |
| 132 // end in a parent process and one end in a child process. In a child process, | 127 // end in a parent process and one end in a child process. In a child process, |
| 133 // either PreInitializeChildProcess() or SetParentPipe() must have been been | 128 // either PreInitializeChildProcess() or SetParentPipe() must have been been |
| 134 // called at least once already. | 129 // called at least once already. |
| 135 // | 130 // |
| 131 // Note: This only exists for backwards compatibility with embedders that rely |
| 132 // on mojo::embedder::CreateChannel() behavior. If you have a means of passing |
| 133 // platform handles around, you can probably also pass strings around. If you |
| 134 // can pass strings around, use CreateParentMessagePipe() and |
| 135 // CreateChlidMessagePipe() instead (see below.) |
| 136 // |
| 136 // |callback| must be safe to call from any thread. | 137 // |callback| must be safe to call from any thread. |
| 137 // | |
| 138 // DEPRECATED: Please don't use this. Use the synchronous version above. This | |
| 139 // is now merely an inconvenient wrapper for that. | |
| 140 MOJO_SYSTEM_IMPL_EXPORT void | 138 MOJO_SYSTEM_IMPL_EXPORT void |
| 141 CreateMessagePipe( | 139 CreateMessagePipe( |
| 142 ScopedPlatformHandle platform_handle, | 140 ScopedPlatformHandle platform_handle, |
| 143 const base::Callback<void(ScopedMessagePipeHandle)>& callback); | 141 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
| 144 | 142 |
| 145 // Creates a message pipe from a token. A child embedder must also have this | 143 // Creates a message pipe from a token. A child embedder must also have this |
| 146 // token and call CreateChildMessagePipe() with it in order for the pipe to get | 144 // token and call CreateChildMessagePipe() with it in order for the pipe to get |
| 147 // connected. | 145 // connected. |
| 148 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | |
| 149 CreateParentMessagePipe(const std::string& token); | |
| 150 | |
| 151 // Creates a message pipe from a token. A child embedder must also have this | |
| 152 // token and call CreateChildMessagePipe() with it in order for the pipe to get | |
| 153 // connected. | |
| 154 // | 146 // |
| 155 // |callback| must be safe to call from any thread. | 147 // |callback| must be safe to call from any thread. |
| 156 // | |
| 157 // DEPRECATED: Please don't use this. Use the synchronous version above. This | |
| 158 // is now merely an inconvenient wrapper for that. | |
| 159 MOJO_SYSTEM_IMPL_EXPORT void | 148 MOJO_SYSTEM_IMPL_EXPORT void |
| 160 CreateParentMessagePipe( | 149 CreateParentMessagePipe( |
| 161 const std::string& token, | 150 const std::string& token, |
| 162 const base::Callback<void(ScopedMessagePipeHandle)>& callback); | 151 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
| 163 | 152 |
| 164 // Creates a message pipe from a token in a child process. The parent must also | 153 // Creates a message pipe from a token in a child process. The parent must also |
| 165 // have this token and call CreateParentMessagePipe() with it in order for the | 154 // have this token and call CreateParentMessagePipe() with it in order for the |
| 166 // pipe to get connected. | 155 // pipe to get connected. |
| 167 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | |
| 168 CreateChildMessagePipe(const std::string& token); | |
| 169 | |
| 170 // Creates a message pipe from a token in a child process. The parent must also | |
| 171 // have this token and call CreateParentMessagePipe() with it in order for the | |
| 172 // pipe to get connected. | |
| 173 // | 156 // |
| 174 // |callback| must be safe to call from any thread. | 157 // |callback| must be safe to call from any thread. |
| 175 // | |
| 176 // DEPRECATED: Please don't use this. Use the synchronous version above. This | |
| 177 // is now merely an inconvenient wrapper for that. | |
| 178 MOJO_SYSTEM_IMPL_EXPORT void | 158 MOJO_SYSTEM_IMPL_EXPORT void |
| 179 CreateChildMessagePipe( | 159 CreateChildMessagePipe( |
| 180 const std::string& token, | 160 const std::string& token, |
| 181 const base::Callback<void(ScopedMessagePipeHandle)>& callback); | 161 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
| 182 | 162 |
| 183 // Generates a random ASCII token string for use with CreateParentMessagePipe() | 163 // Generates a random ASCII token string for use with CreateParentMessagePipe() |
| 184 // and CreateChildMessagePipe() above. The generated token is suitably random so | 164 // and CreateChildMessagePipe() above. The generated token is suitably random so |
| 185 // as to not have to worry about collisions with other generated tokens. | 165 // as to not have to worry about collisions with other generated tokens. |
| 186 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); | 166 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); |
| 187 | 167 |
| 188 } // namespace edk | 168 } // namespace edk |
| 189 } // namespace mojo | 169 } // namespace mojo |
| 190 | 170 |
| 191 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 171 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
| OLD | NEW |