Index: third_party/mojo/src/mojo/edk/embedder/embedder.cc |
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder.cc b/third_party/mojo/src/mojo/edk/embedder/embedder.cc |
index 31ec8930675c7bfc095343e0c4f723de70d0004b..671dc78cd138021caf44aefa7178bad2a06f67b7 100644 |
--- a/third_party/mojo/src/mojo/edk/embedder/embedder.cc |
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder.cc |
@@ -92,29 +92,47 @@ system::ChannelId MakeChannelId() { |
return static_cast<system::ChannelId>(-new_counter_value); |
} |
-} // namespace |
- |
+edk::ScopedPlatformHandle CreateEDKHandle(ScopedPlatformHandle handle) { |
+ return edk::ScopedPlatformHandle(edk::PlatformHandle( |
#if defined(OS_WIN) |
-void PreInitializeParentProcess() { |
- edk::PreInitializeParentProcess(); |
+ handle.release().handle)); |
+#else |
+ handle.release().fd)); |
+#endif |
} |
-void PreInitializeChildProcess() { |
- edk::PreInitializeChildProcess(); |
+ScopedPlatformHandle CreateHandle(edk::ScopedPlatformHandle handle) { |
+ return ScopedPlatformHandle(PlatformHandle( |
+#if defined(OS_WIN) |
+ handle.release().handle)); |
+#else |
+ handle.release().fd)); |
+#endif |
} |
-HANDLE ChildProcessLaunched(HANDLE child_process) { |
- return edk::ChildProcessLaunched(child_process); |
-} |
+} // namespace |
-void ChildProcessLaunched(HANDLE child_process, HANDLE server_pipe) { |
- return edk::ChildProcessLaunched(child_process, server_pipe); |
+void PreInitializeParentProcess() { |
+ edk::PreInitializeParentProcess(); |
+} |
+ |
+void PreInitializeChildProcess() { |
+ edk::PreInitializeChildProcess(); |
+} |
+ |
+ScopedPlatformHandle ChildProcessLaunched(base::ProcessHandle child_process) { |
+ return CreateHandle(edk::ChildProcessLaunched(child_process).Pass()); |
} |
-void SetParentPipeHandle(HANDLE pipe) { |
- edk::SetParentPipeHandle(pipe); |
+void ChildProcessLaunched(base::ProcessHandle child_process, |
+ ScopedPlatformHandle server_pipe) { |
+ return edk::ChildProcessLaunched( |
+ child_process, CreateEDKHandle(server_pipe.Pass())); |
+} |
+ |
+void SetParentPipeHandle(ScopedPlatformHandle pipe) { |
+ edk::SetParentPipeHandle(CreateEDKHandle(pipe.Pass())); |
} |
-#endif |
void SetMaxMessageSize(size_t bytes) { |
system::GetMutableConfiguration()->max_message_num_bytes = bytes; |
@@ -145,14 +163,9 @@ MojoResult CreatePlatformHandleWrapper( |
MojoHandle* platform_handle_wrapper_handle) { |
DCHECK(platform_handle_wrapper_handle); |
if (UseNewEDK()) { |
- mojo::edk::ScopedPlatformHandle edk_handle(mojo::edk::PlatformHandle( |
-#if defined(OS_WIN) |
- platform_handle.release().handle)); |
-#else |
- platform_handle.release().fd)); |
-#endif |
return mojo::edk::CreatePlatformHandleWrapper( |
- edk_handle.Pass(), platform_handle_wrapper_handle); |
+ CreateEDKHandle(platform_handle.Pass()), |
+ platform_handle_wrapper_handle); |
} |
scoped_refptr<system::Dispatcher> dispatcher = |
@@ -345,13 +358,8 @@ ScopedMessagePipeHandle CreateChannel( |
if (UseNewEDK()) { |
if (!did_create_channel_callback.is_null()) |
did_create_channel_callback.Run(nullptr); |
- mojo::edk::ScopedPlatformHandle edk_handle(mojo::edk::PlatformHandle( |
-#if defined(OS_WIN) |
- platform_handle.release().handle)); |
-#else |
- platform_handle.release().fd)); |
-#endif |
- return mojo::edk::CreateMessagePipe(edk_handle.Pass()); |
+ return mojo::edk::CreateMessagePipe( |
+ CreateEDKHandle(platform_handle.Pass())); |
} |
system::ChannelManager* channel_manager = |