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

Unified Diff: mojo/edk/system/core.cc

Issue 1488853002: Add multiplexing of message pipes in the new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez review comments Created 5 years 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
« no previous file with comments | « mojo/edk/system/child_broker_host.cc ('k') | mojo/edk/system/core_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/core.cc
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index 77b06f0cc4ac549eda110c66ef1a2655a3957df2..454b487190d03ef1ed33f9c971ce5bf4764d07b5 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/logging.h"
+#include "base/rand_util.h"
#include "base/time/time.h"
#include "mojo/edk/embedder/embedder_internal.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
@@ -206,18 +207,28 @@ MojoResult Core::CreateMessagePipe(
return MOJO_RESULT_RESOURCE_EXHAUSTED;
}
- ScopedPlatformHandle server_handle, client_handle;
+ if (validated_options.flags &
+ MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE) {
+ ScopedPlatformHandle server_handle, client_handle;
#if defined(OS_WIN)
- internal::g_broker->CreatePlatformChannelPair(&server_handle, &client_handle);
+ internal::g_broker->CreatePlatformChannelPair(&server_handle,
+ &client_handle);
#else
- PlatformChannelPair channel_pair;
- server_handle = channel_pair.PassServerHandle();
- client_handle = channel_pair.PassClientHandle();
+ PlatformChannelPair channel_pair;
+ 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);
+ dispatcher0->Init(server_handle.Pass(), nullptr, 0u, nullptr, 0u, nullptr,
+ nullptr);
+ dispatcher1->Init(client_handle.Pass(), nullptr, 0u, nullptr, 0u, nullptr,
+ nullptr);
+ } else {
+ uint64_t pipe_id = 0;
+ while (pipe_id == 0)
+ pipe_id = base::RandUint64();
+ dispatcher0->InitNonTransferable(pipe_id);
+ dispatcher1->InitNonTransferable(pipe_id);
+ }
*message_pipe_handle0 = handle_pair.first;
*message_pipe_handle1 = handle_pair.second;
« no previous file with comments | « mojo/edk/system/child_broker_host.cc ('k') | mojo/edk/system/core_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698