Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1280)

Unified Diff: mojo/edk/embedder/embedder.h

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698