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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1881463002: Set GpuPreferences correctly in GpuDataManagerImplPrivate::AppendGpuCommandLine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); 540 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD);
541 541
542 std::string channel_id = process_->GetHost()->CreateChannel(); 542 std::string channel_id = process_->GetHost()->CreateChannel();
543 if (channel_id.empty()) 543 if (channel_id.empty())
544 return false; 544 return false;
545 545
546 if (!SetupMojo()) 546 if (!SetupMojo())
547 return false; 547 return false;
548 548
549 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine();
549 if (in_process_) { 550 if (in_process_) {
550 DCHECK_CURRENTLY_ON(BrowserThread::IO); 551 DCHECK_CURRENTLY_ON(BrowserThread::IO);
551 DCHECK(g_gpu_main_thread_factory); 552 DCHECK(g_gpu_main_thread_factory);
552 in_process_gpu_thread_.reset( 553 in_process_gpu_thread_.reset(
553 g_gpu_main_thread_factory(InProcessChildThreadParams( 554 g_gpu_main_thread_factory(InProcessChildThreadParams(
554 channel_id, base::MessageLoop::current()->task_runner()), 555 channel_id, base::MessageLoop::current()->task_runner()),
555 GetGpuPreferencesFromCommandLine())); 556 gpu_preferences));
556 base::Thread::Options options; 557 base::Thread::Options options;
557 #if defined(OS_WIN) 558 #if defined(OS_WIN)
558 // WGL needs to create its own window and pump messages on it. 559 // WGL needs to create its own window and pump messages on it.
559 options.message_loop_type = base::MessageLoop::TYPE_UI; 560 options.message_loop_type = base::MessageLoop::TYPE_UI;
560 #endif 561 #endif
561 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 562 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
562 options.priority = base::ThreadPriority::DISPLAY; 563 options.priority = base::ThreadPriority::DISPLAY;
563 #endif 564 #endif
564 in_process_gpu_thread_->StartWithOptions(options); 565 in_process_gpu_thread_->StartWithOptions(options);
565 566
566 OnProcessLaunched(); // Fake a callback that the process is ready. 567 OnProcessLaunched(); // Fake a callback that the process is ready.
567 } else if (!LaunchGpuProcess(channel_id)) { 568 } else if (!LaunchGpuProcess(channel_id, &gpu_preferences)) {
568 return false; 569 return false;
569 } 570 }
570 571
571 if (!Send(new GpuMsg_Initialize(GetGpuPreferencesFromCommandLine()))) 572 if (!Send(new GpuMsg_Initialize(gpu_preferences)))
572 return false; 573 return false;
573 574
574 return true; 575 return true;
575 } 576 }
576 577
577 bool GpuProcessHost::SetupMojo() { 578 bool GpuProcessHost::SetupMojo() {
578 DCHECK(!mojo_application_host_); 579 DCHECK(!mojo_application_host_);
579 mojo_application_host_.reset(new MojoApplicationHost); 580 mojo_application_host_.reset(new MojoApplicationHost);
580 return mojo_application_host_->Init(); 581 return mojo_application_host_->Init();
581 } 582 }
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 if (g_gpu_process_hosts[kind_] == this) 939 if (g_gpu_process_hosts[kind_] == this)
939 g_gpu_process_hosts[kind_] = NULL; 940 g_gpu_process_hosts[kind_] = NULL;
940 941
941 process_->ForceShutdown(); 942 process_->ForceShutdown();
942 } 943 }
943 944
944 void GpuProcessHost::StopGpuProcess() { 945 void GpuProcessHost::StopGpuProcess() {
945 Send(new GpuMsg_Finalize()); 946 Send(new GpuMsg_Finalize());
946 } 947 }
947 948
948 bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { 949 bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id,
950 gpu::GpuPreferences* gpu_preferences) {
949 if (!(gpu_enabled_ && 951 if (!(gpu_enabled_ &&
950 GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) && 952 GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) &&
951 !hardware_gpu_enabled_) { 953 !hardware_gpu_enabled_) {
952 SendOutstandingReplies(); 954 SendOutstandingReplies();
953 return false; 955 return false;
954 } 956 }
955 957
956 const base::CommandLine& browser_command_line = 958 const base::CommandLine& browser_command_line =
957 *base::CommandLine::ForCurrentProcess(); 959 *base::CommandLine::ForCurrentProcess();
958 960
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 // you need to add it to |kSwitchNames| at the beginning of this file. 998 // you need to add it to |kSwitchNames| at the beginning of this file.
997 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, 999 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
998 arraysize(kSwitchNames)); 1000 arraysize(kSwitchNames));
999 cmd_line->CopySwitchesFrom( 1001 cmd_line->CopySwitchesFrom(
1000 browser_command_line, switches::kGLSwitchesCopiedFromGpuProcessHost, 1002 browser_command_line, switches::kGLSwitchesCopiedFromGpuProcessHost,
1001 switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches); 1003 switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches);
1002 1004
1003 GetContentClient()->browser()->AppendExtraCommandLineSwitches( 1005 GetContentClient()->browser()->AppendExtraCommandLineSwitches(
1004 cmd_line, process_->GetData().id); 1006 cmd_line, process_->GetData().id);
1005 1007
1006 GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line); 1008 GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line,
1007 1009 gpu_preferences);
1008 if (cmd_line->HasSwitch(switches::kUseGL)) { 1010 if (cmd_line->HasSwitch(switches::kUseGL)) {
1009 swiftshader_rendering_ = 1011 swiftshader_rendering_ =
1010 (cmd_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"); 1012 (cmd_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader");
1011 } 1013 }
1012 1014
1013 UMA_HISTOGRAM_BOOLEAN("GPU.GPU.GPUProcessSoftwareRendering", 1015 UMA_HISTOGRAM_BOOLEAN("GPU.GPU.GPUProcessSoftwareRendering",
1014 swiftshader_rendering_); 1016 swiftshader_rendering_);
1015 1017
1016 // If specified, prepend a launcher program to the command line. 1018 // If specified, prepend a launcher program to the command line.
1017 if (!gpu_launcher.empty()) 1019 if (!gpu_launcher.empty())
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1166 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1165 ClientIdToShaderCacheMap::iterator iter = 1167 ClientIdToShaderCacheMap::iterator iter =
1166 client_id_to_shader_cache_.find(client_id); 1168 client_id_to_shader_cache_.find(client_id);
1167 // If the cache doesn't exist then this is an off the record profile. 1169 // If the cache doesn't exist then this is an off the record profile.
1168 if (iter == client_id_to_shader_cache_.end()) 1170 if (iter == client_id_to_shader_cache_.end())
1169 return; 1171 return;
1170 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1172 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1171 } 1173 }
1172 1174
1173 } // namespace content 1175 } // namespace content
OLDNEW
« content/browser/gpu/gpu_data_manager_impl.h ('K') | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698