Index: mojo/edk/system/core.cc |
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc |
index aad9541642fcad64ef94c40dc7cfd2ef8feeceae..e6ca186ec993f52d03646c29c36a0f040f3e4d15 100644 |
--- a/mojo/edk/system/core.cc |
+++ b/mojo/edk/system/core.cc |
@@ -160,14 +160,22 @@ void Core::RequestShutdown(const base::Closure& callback) { |
GetNodeController()->RequestShutdown(on_shutdown); |
} |
+ScopedMessagePipeHandle Core::CreateMessagePipe( |
+ ScopedPlatformHandle platform_handle) { |
+ ports::PortRef port0, port1; |
+ GetNodeController()->node()->CreatePortPair(&port0, &port1); |
+ MojoHandle handle = AddDispatcher( |
+ new MessagePipeDispatcher(GetNodeController(), port0, |
+ 0x7f7f7f7f7f7f7f7fUL, 0)); |
+ RemoteMessagePipeBootstrap::Create( |
+ GetNodeController(), std::move(platform_handle), port1); |
+ return ScopedMessagePipeHandle(MessagePipeHandle(handle)); |
+} |
+ |
void Core::CreateMessagePipe( |
ScopedPlatformHandle platform_handle, |
const base::Callback<void(ScopedMessagePipeHandle)>& callback) { |
- ports::PortRef port; |
- GetNodeController()->node()->CreateUninitializedPort(&port); |
- RemoteMessagePipeBootstrap::Create( |
- GetNodeController(), std::move(platform_handle), port, |
- base::Bind(&OnPortConnected, base::Unretained(this), 0, callback, port)); |
+ callback.Run(CreateMessagePipe(std::move(platform_handle))); |
} |
void Core::CreateParentMessagePipe( |