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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 2221153003: Establish MojoChildConnection from BrowserChildProcessHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-channel
Patch Set: rebase Created 4 years, 4 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 | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 16e68eff5fb313fc3ff96773887ced62efabbc4d..d22a69bd9ea637ea8c7685b411c74b52c07205c9 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -416,6 +416,10 @@ void GpuProcessHost::RegisterGpuMainThreadFactory(
g_gpu_main_thread_factory = create;
}
+shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
+ return process_->child_connection()->GetRemoteInterfaces();
+}
+
// static
GpuProcessHost* GpuProcessHost::FromID(int host_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -437,8 +441,7 @@ GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind)
kind_(kind),
process_launched_(false),
initialized_(false),
- uma_memory_stats_received_(false),
- child_token_(mojo::edk::GenerateRandomToken()) {
+ uma_memory_stats_received_(false) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess) ||
base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -462,8 +465,8 @@ GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind)
FROM_HERE,
base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id));
- process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_GPU, this,
- child_token_));
+ process_.reset(new BrowserChildProcessHostImpl(
+ PROCESS_TYPE_GPU, this, kGpuMojoApplicationName));
}
GpuProcessHost::~GpuProcessHost() {
@@ -577,16 +580,7 @@ bool GpuProcessHost::Init() {
base::MakeUnique<ConnectionFilterImpl>(this));
}
- const std::string mojo_channel_token =
- process_->GetHost()->CreateChannelMojo(child_token_);
- if (mojo_channel_token.empty())
- return false;
-
- DCHECK(!mojo_child_connection_);
- mojo_child_connection_.reset(new MojoChildConnection(
- kGpuMojoApplicationName, "", child_token_,
- MojoShellContext::GetConnectorForIOThread(),
- BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
+ process_->GetHost()->CreateChannelMojo();
gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine();
if (in_process_) {
@@ -595,7 +589,8 @@ bool GpuProcessHost::Init() {
in_process_gpu_thread_.reset(g_gpu_main_thread_factory(
InProcessChildThreadParams(
std::string(), base::ThreadTaskRunnerHandle::Get(),
- mojo_channel_token, mojo_child_connection_->service_token()),
+ std::string(),
+ process_->child_connection()->service_token()),
gpu_preferences));
base::Thread::Options options;
#if defined(OS_WIN)
@@ -608,7 +603,7 @@ bool GpuProcessHost::Init() {
in_process_gpu_thread_->StartWithOptions(options);
OnProcessLaunched(); // Fake a callback that the process is ready.
- } else if (!LaunchGpuProcess(mojo_channel_token, &gpu_preferences)) {
+ } else if (!LaunchGpuProcess(&gpu_preferences)) {
return false;
}
@@ -956,10 +951,6 @@ void GpuProcessHost::OnProcessCrashed(int exit_code) {
process_->GetTerminationStatus(true /* known_dead */, NULL));
}
-shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
- return mojo_child_connection_->GetRemoteInterfaces();
-}
-
GpuProcessHost::GpuProcessKind GpuProcessHost::kind() {
return kind_;
}
@@ -977,8 +968,7 @@ void GpuProcessHost::StopGpuProcess() {
Send(new GpuMsg_Finalize());
}
-bool GpuProcessHost::LaunchGpuProcess(const std::string& mojo_channel_token,
- gpu::GpuPreferences* gpu_preferences) {
+bool GpuProcessHost::LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences) {
if (!(gpu_enabled_ &&
GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) &&
!hardware_gpu_enabled_) {
@@ -1013,9 +1003,6 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& mojo_channel_token,
base::CommandLine* cmd_line = new base::CommandLine(exe_path);
#endif
cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess);
- cmd_line->AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token);
- cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken,
- mojo_child_connection_->service_token());
BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line);
#if defined(OS_WIN)
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698