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

Unified Diff: content/browser/utility_process_host_impl.cc

Issue 2096643002: Eliminate MojoApplicationHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mah3
Patch Set: . Created 4 years, 6 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: content/browser/utility_process_host_impl.cc
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc
index b211eeb62040b226e378992cb67a6bd58d542439..5030b004fb990ec8dc9d293561303a2c9fcfc8b0 100644
--- a/content/browser/utility_process_host_impl.cc
+++ b/content/browser/utility_process_host_impl.cc
@@ -22,7 +22,9 @@
#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
#include "content/browser/browser_child_process_host_impl.h"
-#include "content/browser/mojo/mojo_application_host.h"
+#include "content/browser/mojo/constants.h"
+#include "content/browser/mojo/mojo_child_connection.h"
+#include "content/browser/mojo/mojo_shell_context.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/in_process_child_thread_params.h"
@@ -32,11 +34,15 @@
#include "content/public/browser/utility_process_host_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mojo_channel_switches.h"
+#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/process_type.h"
#include "content/public/common/sandbox_type.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "ipc/ipc_switches.h"
#include "mojo/edk/embedder/embedder.h"
+#include "services/shell/public/cpp/connection.h"
+#include "services/shell/public/cpp/interface_provider.h"
+#include "services/shell/public/cpp/interface_registry.h"
#include "ui/base/ui_base_switches.h"
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
@@ -160,7 +166,6 @@ UtilityProcessHostImpl::UtilityProcessHostImpl(
started_(false),
name_(base::ASCIIToUTF16("utility process")),
child_token_(mojo::edk::GenerateRandomToken()),
- mojo_application_host_(new MojoApplicationHost(child_token_)),
weak_ptr_factory_(this) {
}
@@ -225,9 +230,12 @@ bool UtilityProcessHostImpl::Start() {
return StartProcess();
}
-ServiceRegistry* UtilityProcessHostImpl::GetServiceRegistry() {
- DCHECK(mojo_application_host_);
- return mojo_application_host_->service_registry();
+shell::InterfaceRegistry* UtilityProcessHostImpl::GetInterfaceRegistry() {
+ return mojo_child_connection_->connection()->GetInterfaceRegistry();
+}
+
+shell::InterfaceProvider* UtilityProcessHostImpl::GetRemoteInterfaces() {
+ return mojo_child_connection_->connection()->GetRemoteInterfaces();
}
void UtilityProcessHostImpl::SetName(const base::string16& name) {
@@ -256,6 +264,12 @@ bool UtilityProcessHostImpl::StartProcess() {
child_token_));
process_->SetName(name_);
+ mojo_child_connection_.reset(new MojoChildConnection(
+ kUtilityMojoApplicationName,
+ base::StringPrintf("%d_0", process_->GetData().id),
+ child_token_,
+ MojoShellContext::GetConnectorForIOThread()));
+
std::string mojo_channel_token =
process_->GetHost()->CreateChannelMojo(child_token_);
if (mojo_channel_token.empty()) {
@@ -271,7 +285,7 @@ bool UtilityProcessHostImpl::StartProcess() {
g_utility_main_thread_factory(InProcessChildThreadParams(
std::string(), BrowserThread::UnsafeGetMessageLoopForThread(
BrowserThread::IO)->task_runner(),
- mojo_channel_token, mojo_application_host_->GetToken())));
+ mojo_channel_token, mojo_child_connection_->shell_client_token())));
in_process_thread_->Start();
} else {
const base::CommandLine& browser_command_line =
@@ -350,7 +364,7 @@ bool UtilityProcessHostImpl::StartProcess() {
#endif
cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken,
- mojo_application_host_->GetToken());
+ mojo_child_connection_->shell_client_token());
process_->Launch(
new UtilitySandboxedProcessLauncherDelegate(exposed_dir_,
« no previous file with comments | « content/browser/utility_process_host_impl.h ('k') | content/browser/utility_process_host_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698