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 // Unused. Crashes. Only here for linking. | 121 // Creates a message pipe over an arbitrary platform channel. The other end of |
| 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. |
122 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle | 127 MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
123 CreateMessagePipe(ScopedPlatformHandle platform_handle); | 128 CreateMessagePipe(ScopedPlatformHandle platform_handle); |
124 | 129 |
125 // Creates a message pipe over an arbitrary platform channel. In order for this | 130 // Creates a message pipe over an arbitrary platform channel. In order for this |
126 // to work properly each end of the channel must be passed to this function: one | 131 // to work properly each end of the channel must be passed to this function: one |
127 // end in a parent process and one end in a child process. In a child process, | 132 // end in a parent process and one end in a child process. In a child process, |
128 // either PreInitializeChildProcess() or SetParentPipe() must have been been | 133 // either PreInitializeChildProcess() or SetParentPipe() must have been been |
129 // called at least once already. | 134 // called at least once already. |
130 // | 135 // |
131 // Note: This only exists for backwards compatibility with embedders that rely | 136 // |callback| must be safe to call from any thread. |
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 // | 137 // |
137 // |callback| must be safe to call from any thread. | 138 // DEPRECATED: Please don't use this. Use the synchronous version above. This |
| 139 // is now merely an inconvenient wrapper for that. |
138 MOJO_SYSTEM_IMPL_EXPORT void | 140 MOJO_SYSTEM_IMPL_EXPORT void |
139 CreateMessagePipe( | 141 CreateMessagePipe( |
140 ScopedPlatformHandle platform_handle, | 142 ScopedPlatformHandle platform_handle, |
141 const base::Callback<void(ScopedMessagePipeHandle)>& callback); | 143 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
142 | 144 |
143 // Creates a message pipe from a token. A child embedder must also have this | 145 // Creates a message pipe from a token. A child embedder must also have this |
144 // token and call CreateChildMessagePipe() with it in order for the pipe to get | 146 // token and call CreateChildMessagePipe() with it in order for the pipe to get |
145 // connected. | 147 // 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. |
146 // | 154 // |
147 // |callback| must be safe to call from any thread. | 155 // |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. |
148 MOJO_SYSTEM_IMPL_EXPORT void | 159 MOJO_SYSTEM_IMPL_EXPORT void |
149 CreateParentMessagePipe( | 160 CreateParentMessagePipe( |
150 const std::string& token, | 161 const std::string& token, |
151 const base::Callback<void(ScopedMessagePipeHandle)>& callback); | 162 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
152 | 163 |
153 // Creates a message pipe from a token in a child process. The parent must also | 164 // Creates a message pipe from a token in a child process. The parent must also |
154 // have this token and call CreateParentMessagePipe() with it in order for the | 165 // have this token and call CreateParentMessagePipe() with it in order for the |
155 // pipe to get connected. | 166 // 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. |
156 // | 173 // |
157 // |callback| must be safe to call from any thread. | 174 // |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. |
158 MOJO_SYSTEM_IMPL_EXPORT void | 178 MOJO_SYSTEM_IMPL_EXPORT void |
159 CreateChildMessagePipe( | 179 CreateChildMessagePipe( |
160 const std::string& token, | 180 const std::string& token, |
161 const base::Callback<void(ScopedMessagePipeHandle)>& callback); | 181 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
162 | 182 |
163 // Generates a random ASCII token string for use with CreateParentMessagePipe() | 183 // Generates a random ASCII token string for use with CreateParentMessagePipe() |
164 // and CreateChildMessagePipe() above. The generated token is suitably random so | 184 // and CreateChildMessagePipe() above. The generated token is suitably random so |
165 // as to not have to worry about collisions with other generated tokens. | 185 // as to not have to worry about collisions with other generated tokens. |
166 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); | 186 MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); |
167 | 187 |
168 } // namespace edk | 188 } // namespace edk |
169 } // namespace mojo | 189 } // namespace mojo |
170 | 190 |
171 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ | 191 #endif // MOJO_EDK_EMBEDDER_EMBEDDER_H_ |
OLD | NEW |