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

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

Issue 1901513003: Re-land: "Use a token to initialise ChannelMojo and MojoApplication everywhere." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_application_host.h » ('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 1cb9675cb486b298140478f3c7334e820c71f87e..909e82d595e5a060a0d5be14610572a01a6b88f7 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -43,6 +43,7 @@
#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/mojo_channel_switches.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/sandbox_type.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
@@ -537,8 +538,8 @@ bool GpuProcessHost::Init() {
if (channel_id.empty())
return false;
- if (!SetupMojo())
- return false;
+ DCHECK(!mojo_application_host_);
+ mojo_application_host_.reset(new MojoApplicationHost);
gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine();
if (in_process_) {
@@ -546,7 +547,8 @@ bool GpuProcessHost::Init() {
DCHECK(g_gpu_main_thread_factory);
in_process_gpu_thread_.reset(
g_gpu_main_thread_factory(InProcessChildThreadParams(
- channel_id, base::MessageLoop::current()->task_runner()),
+ channel_id, base::MessageLoop::current()->task_runner(),
+ std::string(), mojo_application_host_->GetToken()),
gpu_preferences));
base::Thread::Options options;
#if defined(OS_WIN)
@@ -569,12 +571,6 @@ bool GpuProcessHost::Init() {
return true;
}
-bool GpuProcessHost::SetupMojo() {
- DCHECK(!mojo_application_host_);
- mojo_application_host_.reset(new MojoApplicationHost);
- return mojo_application_host_->Init();
-}
-
void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) {
BrowserThread::PostTask(
BrowserThread::UI,
@@ -898,14 +894,6 @@ void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
void GpuProcessHost::OnProcessLaunched() {
UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime",
base::TimeTicks::Now() - init_start_time_);
-
- base::ProcessHandle handle;
- if (in_process_)
- handle = base::GetCurrentProcessHandle();
- else
- handle = process_->GetData().handle;
-
- mojo_application_host_->Activate(this, handle);
}
void GpuProcessHost::OnProcessLaunchFailed() {
@@ -977,6 +965,8 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id,
#endif
cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess);
cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
+ cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken,
+ mojo_application_host_->GetToken());
#if defined(OS_WIN)
if (GetContentClient()->browser()->ShouldUseWindowsPrefetchArgument())
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/mojo/mojo_application_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698