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

Unified Diff: chrome/browser/service_process/service_process_control.cc

Issue 2139643003: Use ChannelMojo between browser and service processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
Index: chrome/browser/service_process/service_process_control.cc
diff --git a/chrome/browser/service_process/service_process_control.cc b/chrome/browser/service_process/service_process_control.cc
index c1b7bd815e2213df7249b59e4af7777a618ec723..0977d09818058c20198bafa400031fd1c270b853 100644
--- a/chrome/browser/service_process/service_process_control.cc
+++ b/chrome/browser/service_process/service_process_control.cc
@@ -28,9 +28,29 @@
#include "chrome/common/service_process_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
+#include "ipc/ipc_channel_mojo.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/named_platform_handle.h"
+#include "mojo/edk/embedder/named_platform_handle_utils.h"
using content::BrowserThread;
+namespace {
+
+void ConnectOnBlockingPool(mojo::ScopedMessagePipeHandle handle,
+ mojo::edk::NamedPlatformHandle os_pipe) {
+ mojo::edk::ScopedPlatformHandle os_pipe_handle =
+ mojo::edk::CreateClientHandle(os_pipe);
+ if (!os_pipe_handle.is_valid())
+ return;
+
+ mojo::FuseMessagePipes(
+ mojo::edk::ConnectToPeerProcess(std::move(os_pipe_handle)),
+ std::move(handle));
+}
+
+} // namespace
+
// ServiceProcessControl implementation.
ServiceProcessControl::ServiceProcessControl() {
}
@@ -49,11 +69,18 @@ void ServiceProcessControl::ConnectInternal() {
// Actually going to connect.
DVLOG(1) << "Connecting to Service Process IPC Server";
+ mojo::MessagePipe pipe;
+ BrowserThread::PostBlockingPoolTask(
+ FROM_HERE, base::Bind(&ConnectOnBlockingPool, base::Passed(&pipe.handle1),
+ mojo::edk::NamedPlatformHandle(
+ GetServiceProcessChannel().name)));
// TODO(hclam): Handle error connecting to channel.
- const IPC::ChannelHandle channel_id = GetServiceProcessChannel();
- SetChannel(IPC::ChannelProxy::Create(
- channel_id, IPC::Channel::MODE_NAMED_CLIENT, this,
- BrowserThread::GetTaskRunnerForThread(BrowserThread::IO).get()));
+ auto io_task_runner =
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
+ SetChannel(
+ IPC::ChannelProxy::Create(IPC::ChannelMojo::CreateClientFactory(
+ std::move(pipe.handle0), io_task_runner),
+ this, io_task_runner));
}
void ServiceProcessControl::SetChannel(
« no previous file with comments | « chrome/browser/service_process/DEPS ('k') | chrome/browser/service_process/service_process_control_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698