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

Unified Diff: mojo/edk/system/core.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/system/core.cc
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index ac513da7335452ae3c7f6a8625783202cfa4d7d4..af9d151cc9198fb4932c36672fdadda5cd583387 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/time/time.h"
+#include "mojo/edk/embedder/embedder_internal.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/platform_shared_buffer.h"
#include "mojo/edk/embedder/platform_support.h"
@@ -24,6 +25,10 @@
#include "mojo/public/c/system/macros.h"
#include "mojo/public/cpp/system/macros.h"
+#if defined(OS_WIN)
+#include "mojo/edk/system/token_serializer_win.h"
+#endif
+
namespace mojo {
namespace edk {
@@ -204,11 +209,19 @@ MojoResult Core::CreateMessagePipe(
return MOJO_RESULT_RESOURCE_EXHAUSTED;
}
+ ScopedPlatformHandle server_handle, client_handle;
+#if defined(OS_WIN)
+ internal::g_token_serializer->CreatePlatformChannelPair(
+ &server_handle, &client_handle);
+#else
PlatformChannelPair channel_pair;
- dispatcher0->Init(channel_pair.PassServerHandle(), nullptr, 0u, nullptr, 0u,
- nullptr, nullptr);
- dispatcher1->Init(channel_pair.PassClientHandle(), nullptr, 0u, nullptr, 0u,
- nullptr, nullptr);
+ server_handle = channel_pair.PassServerHandle();
+ client_handle = channel_pair.PassClientHandle();
+#endif
+ dispatcher0->Init(server_handle.Pass(), nullptr, 0u, nullptr, 0u, nullptr,
+ nullptr);
+ dispatcher1->Init(client_handle.Pass(), nullptr, 0u, nullptr, 0u, nullptr,
+ nullptr);
*message_pipe_handle0 = handle_pair.first;
*message_pipe_handle1 = handle_pair.second;
@@ -364,9 +377,17 @@ MojoResult Core::CreateDataPipe(
}
DCHECK_NE(handle_pair.second, MOJO_HANDLE_INVALID);
+ ScopedPlatformHandle server_handle, client_handle;
+#if defined(OS_WIN)
+ internal::g_token_serializer->CreatePlatformChannelPair(
+ &server_handle, &client_handle);
+#else
PlatformChannelPair channel_pair;
- producer_dispatcher->Init(channel_pair.PassServerHandle(), nullptr, 0u);
- consumer_dispatcher->Init(channel_pair.PassClientHandle(), nullptr, 0u);
+ server_handle = channel_pair.PassServerHandle();
+ client_handle = channel_pair.PassClientHandle();
+#endif
+ producer_dispatcher->Init(server_handle.Pass(), nullptr, 0u);
+ consumer_dispatcher->Init(client_handle.Pass(), nullptr, 0u);
*data_pipe_producer_handle = handle_pair.first;
*data_pipe_consumer_handle = handle_pair.second;

Powered by Google App Engine
This is Rietveld 408576698