Chromium Code Reviews| 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(); |
|
yzshen1
2015/11/20 20:39:55
(optional comment) one idea is to create a token s
jam
2015/11/21 01:26:09
yeah i originally went that route, but then it fel
|
| + 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; |