Chromium Code Reviews| Index: mojo/edk/embedder/embedder.h |
| diff --git a/mojo/edk/embedder/embedder.h b/mojo/edk/embedder/embedder.h |
| index 3393258055a4e632767ccf3251b738f22da21a24..b43748ce154e668c0cc5b685172b1bcc1715faaf 100644 |
| --- a/mojo/edk/embedder/embedder.h |
| +++ b/mojo/edk/embedder/embedder.h |
| @@ -10,6 +10,7 @@ |
| #include <string> |
| #include "base/callback.h" |
| +#include "base/command_line.h" |
|
Anand Mistry (off Chromium)
2016/01/28 02:26:24
You don't use base::CommandLine anywhere in this f
|
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/process/process_handle.h" |
| @@ -117,10 +118,53 @@ MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportOnIOThread(); |
| // |OnShutdownComplete()|. |
| MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport(); |
| -// Creates a message pipe from a platform handle. Safe to call from any thread. |
| +// Unused. Crashes. Only here for linking. |
| MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
| CreateMessagePipe(ScopedPlatformHandle platform_handle); |
| +// Creates a message pipe over an arbitrary platform channel. In order for this |
| +// to work properly each end of the channel must be passed to this function: one |
| +// end in a parent process and one end in a child process. In a child process, |
| +// either PreInitializeChildProcess() or SetParentPipe() must have been been |
| +// called at least once already. |
| +// |
| +// Note: This only exists for backwards compatibility with embedders that rely |
| +// on mojo::embedder::CreateChannel() behavior. If you have a means of passing |
| +// platform handles around, you can probably also pass strings around. If you |
| +// can pass strings around, use CreateParentMessagePipe() and |
| +// CreateChlidMessagePipe() instead (see below.) |
| +// |
| +// |callback| must be safe to call from any thread. |
| +MOJO_SYSTEM_IMPL_EXPORT void |
| +CreateMessagePipe( |
| + ScopedPlatformHandle platform_handle, |
| + const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
| + |
| +// Creates a message pipe from a token. A child embedder must also have this |
| +// token and call CreateChildMessagePipe() with it in order for the pipe to get |
| +// connected. |
| +// |
| +// |callback| must be safe to call from any thread. |
| +MOJO_SYSTEM_IMPL_EXPORT void |
| +CreateParentMessagePipe( |
| + const std::string& token, |
| + const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
| + |
| +// Creates a message pipe from a token in a child process. The parent must also |
| +// have this token and call CreateParentMessagePipe() with it in order for the |
| +// pipe to get connected. |
| +// |
| +// |callback| must be safe to call from any thread. |
| +MOJO_SYSTEM_IMPL_EXPORT void |
| +CreateChildMessagePipe( |
| + const std::string& token, |
| + const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
| + |
| +// Generates a random ASCII token string for use with CreateParentMessagePipe() |
| +// and CreateChildMessagePipe() above. The generated token is suitably random so |
| +// as to not have to worry about collisions with other generated tokens. |
| +MOJO_SYSTEM_IMPL_EXPORT std::string GenerateRandomToken(); |
| + |
| } // namespace edk |
| } // namespace mojo |