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

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

Issue 1387963004: Create a broker interface for the new Mojo EDK so that the browser can create and duplicate messa... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: presubmit whitespace error Created 5 years, 1 month 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.cc
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc
index dd79184cd873b8ac77b680d53dfcaf86501230a1..5ca21f3d119fc44d208268a538efa11f16174931 100644
--- a/mojo/edk/embedder/embedder.cc
+++ b/mojo/edk/embedder/embedder.cc
@@ -13,6 +13,7 @@
#include "base/message_loop/message_loop.h"
#include "base/task_runner.h"
#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/process_delegate.h"
#include "mojo/edk/embedder/simple_platform_support.h"
#include "mojo/edk/system/configuration.h"
@@ -20,6 +21,13 @@
#include "mojo/edk/system/message_pipe_dispatcher.h"
#include "mojo/edk/system/platform_handle_dispatcher.h"
+#if defined(OS_WIN)
+#include "mojo/edk/system/child_token_serializer_win.h"
+#include "mojo/edk/system/parent_token_serializer_state_win.h"
+#include "mojo/edk/system/parent_token_serializer_win.h"
+#include "mojo/edk/system/simple_token_serializer_win.h"
+#endif
+
namespace mojo {
namespace edk {
@@ -49,6 +57,9 @@ void ShutdownIPCSupportHelper(bool wait_for_no_more_channels) {
namespace internal {
// Declared in embedder_internal.h.
+#if defined(OS_WIN)
+TokenSerializer* g_token_serializer = nullptr;
+#endif
PlatformSupport* g_platform_support = nullptr;
Core* g_core = nullptr;
@@ -82,7 +93,40 @@ void SetMaxMessageSize(size_t bytes) {
GetMutableConfiguration()->max_message_num_bytes = bytes;
}
+#if defined(OS_WIN)
+void PreInitializeParentProcess() {
+ ParentTokenSerializerState::GetInstance();
+}
+
+void PreInitializeChildProcess() {
+ ChildTokenSerializer::GetInstance();
+}
+
+HANDLE ChildProcessLaunched(HANDLE child_process) {
+ PlatformChannelPair token_channel;
+ new ParentTokenSerializer(child_process, token_channel.PassServerHandle());
+ return token_channel.PassClientHandle().release().handle;
+}
+
+void ChildProcessLaunched(HANDLE child_process, HANDLE server_pipe) {
+ new ParentTokenSerializer(
+ child_process, ScopedPlatformHandle(PlatformHandle(server_pipe)));
+}
+
+void SetParentPipeHandle(HANDLE pipe) {
+ ScopedPlatformHandle handle;
+ handle.reset(PlatformHandle(pipe));
+ ChildTokenSerializer::GetInstance()->
+ SetParentTokenSerializerHandle(handle.Pass());
+}
+#endif
+
void Init() {
+#if defined(OS_WIN)
+ if (!internal::g_token_serializer)
+ internal::g_token_serializer = new SimpleTokenSerializer;
+#endif
+
DCHECK(!internal::g_platform_support);
internal::g_platform_support = new SimplePlatformSupport();

Powered by Google App Engine
This is Rietveld 408576698