Commit 6d695e6f authored by boliu's avatar boliu Committed by Commit bot

Insert in-process GPU switches on UI thread

For in-process gpu, the CommandLine of the current process is a shared
resource and cannot be safely manipulated on the IO thread.

This moves inserting the gpu command line switches to the UI thread, and
slightly start up. Although still need additional fixes to start up code
to ensure it's safe to manipulate it on UI thread.

This also fixes the bug of inserting gpu switches when GpuProcessHost is
not used, for example in android webview.

BUG=450396

Review URL: https://codereview.chromium.org/865063002

Cr-Commit-Position: refs/heads/master@{#313177}
parent 0162aa21
...@@ -495,8 +495,7 @@ void GpuDataManagerImplPrivate::Initialize() { ...@@ -495,8 +495,7 @@ void GpuDataManagerImplPrivate::Initialize() {
return; return;
} }
const base::CommandLine* command_line = base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) if (command_line->HasSwitch(switches::kSkipGpuDataLoading))
return; return;
...@@ -540,6 +539,12 @@ void GpuDataManagerImplPrivate::Initialize() { ...@@ -540,6 +539,12 @@ void GpuDataManagerImplPrivate::Initialize() {
InitializeImpl(gpu_blacklist_string, InitializeImpl(gpu_blacklist_string,
gpu_driver_bug_list_string, gpu_driver_bug_list_string,
gpu_info); gpu_info);
if (command_line->HasSwitch(switches::kSingleProcess) ||
command_line->HasSwitch(switches::kInProcessGPU)) {
command_line->AppendSwitch(switches::kDisableGpuWatchdog);
AppendGpuCommandLine(command_line);
}
} }
void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() {
......
...@@ -504,13 +504,6 @@ bool GpuProcessHost::Init() { ...@@ -504,13 +504,6 @@ bool GpuProcessHost::Init() {
if (in_process_) { if (in_process_) {
DCHECK(g_gpu_main_thread_factory); DCHECK(g_gpu_main_thread_factory);
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendSwitch(switches::kDisableGpuWatchdog);
GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
DCHECK(gpu_data_manager);
gpu_data_manager->AppendGpuCommandLine(command_line);
in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id)); in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id));
base::Thread::Options options; base::Thread::Options options;
#if defined(OS_WIN) #if defined(OS_WIN)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment