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

Unified Diff: chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.cc

Issue 2680973006: Mojo EDK: Add safe process connection API (Closed)
Patch Set: . Created 3 years, 10 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 | chrome/service/service_utility_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>(),
« no previous file with comments | « no previous file | chrome/service/service_utility_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698