Index: chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc |
diff --git a/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc b/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc |
index b6799d493a17b4ecb1008f577cb3d12a647d18be..203765d743fba65c9bcc75a4e4298196c56c5120 100644 |
--- a/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc |
+++ b/chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc |
@@ -17,6 +17,7 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/gpu_service_registry.h" |
#include "mojo/edk/embedder/embedder.h" |
+#include "mojo/edk/embedder/pending_process_connection.h" |
#include "mojo/edk/embedder/platform_channel_pair.h" |
#include "mojo/public/cpp/bindings/strong_binding.h" |
#include "services/service_manager/public/cpp/interface_provider.h" |
@@ -73,10 +74,9 @@ void GpuArcVideoServiceHost::OnBootstrapVideoAcceleratorFactory( |
// Hardcode pid 0 since it is unused in mojo. |
const base::ProcessHandle kUnusedChildProcessHandle = |
base::kNullProcessHandle; |
+ mojo::edk::PendingProcessConnection process; |
mojo::edk::PlatformChannelPair channel_pair; |
- std::string child_token = mojo::edk::GenerateRandomToken(); |
- mojo::edk::ChildProcessLaunched(kUnusedChildProcessHandle, |
- channel_pair.PassServerHandle(), child_token); |
+ process.Connect(kUnusedChildProcessHandle, channel_pair.PassServerHandle()); |
MojoHandle wrapped_handle; |
MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper( |
@@ -88,14 +88,8 @@ void GpuArcVideoServiceHost::OnBootstrapVideoAcceleratorFactory( |
} |
mojo::ScopedHandle child_handle{mojo::Handle(wrapped_handle)}; |
- std::string token = mojo::edk::GenerateRandomToken(); |
- mojo::ScopedMessagePipeHandle server_pipe = |
- mojo::edk::CreateParentMessagePipe(token, child_token); |
- if (!server_pipe.is_valid()) { |
- LOG(ERROR) << "Invalid pipe"; |
- callback.Run(mojo::ScopedHandle(), std::string()); |
- return; |
- } |
+ std::string token; |
+ mojo::ScopedMessagePipeHandle server_pipe = process.CreateMessagePipe(&token); |
callback.Run(std::move(child_handle), token); |
mojo::MakeStrongBinding(base::MakeUnique<VideoAcceleratorFactoryService>(), |