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

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

Issue 1526923006: [mojo] Implement data pipe using a shared buffer. (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
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe.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 80e9815ac5f21808f7a401330ddbd90d65679a12..e37175552fb972aee56d06ddef4c2e6a82e1e38a 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -470,13 +470,23 @@ MojoResult Core::CreateDataPipe(
ScopedPlatformHandle server_handle, client_handle;
#if defined(OS_WIN)
internal::g_broker->CreatePlatformChannelPair(&server_handle, &client_handle);
+ scoped_refptr<PlatformSharedBuffer> server_buffer =
+ internal::g_platform_support->CreateSharedBuffer(
+ validated_options.capacity_num_bytes);
#else
PlatformChannelPair channel_pair;
server_handle = channel_pair.PassServerHandle();
client_handle = channel_pair.PassClientHandle();
+ scoped_refptr<PlatformSharedBuffer> server_buffer =
+ internal::g_broker->CreateSharedBuffer(
+ validated_options.capacity_num_bytes);
#endif
- producer_dispatcher->Init(std::move(server_handle), nullptr, 0u);
- consumer_dispatcher->Init(std::move(client_handle), nullptr, 0u);
+ scoped_refptr<PlatformSharedBuffer> client_buffer =
+ internal::g_platform_support->CreateSharedBufferFromHandle(
+ validated_options.capacity_num_bytes,
+ server_buffer->DuplicatePlatformHandle());
+ producer_dispatcher->Init(std::move(server_handle), server_buffer);
+ consumer_dispatcher->Init(std::move(client_handle), client_buffer);
*data_pipe_producer_handle = handle_pair.first;
*data_pipe_consumer_handle = handle_pair.second;
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698