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

Unified Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 10 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: gpu/command_buffer/service/in_process_command_buffer.cc
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 7ea7d346bce889851cfe87a0c2bec73e993c9142..344b8358c6808e726105d2488d82cc10029386d3 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -28,8 +28,8 @@
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gl_context_virtual.h"
+#include "gpu/command_buffer/service/gpu_preferences.h"
#include "gpu/command_buffer/service/gpu_scheduler.h"
-#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/image_factory.h"
#include "gpu/command_buffer/service/image_manager.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
@@ -152,8 +152,16 @@ scoped_refptr<InProcessCommandBuffer::Service> GetInitialService(
InProcessCommandBuffer::Service::Service() {}
+InProcessCommandBuffer::Service::Service(const GpuPreferences& gpu_preferences)
+ : gpu_preferences_(gpu_preferences) {}
+
InProcessCommandBuffer::Service::~Service() {}
+const gpu::GpuPreferences&
+InProcessCommandBuffer::Service::gpu_preferences() {
+ return gpu_preferences_;
+}
+
scoped_refptr<gfx::GLShareGroup>
InProcessCommandBuffer::Service::share_group() {
if (!share_group_.get())
@@ -164,7 +172,7 @@ InProcessCommandBuffer::Service::share_group() {
scoped_refptr<gles2::MailboxManager>
InProcessCommandBuffer::Service::mailbox_manager() {
if (!mailbox_manager_.get()) {
- mailbox_manager_ = gles2::MailboxManager::Create();
+ mailbox_manager_ = gles2::MailboxManager::Create(gpu_preferences());
}
return mailbox_manager_;
}
@@ -189,9 +197,10 @@ gpu::gles2::ProgramCache* InProcessCommandBuffer::Service::program_cache() {
if (!program_cache_.get() &&
(gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary ||
gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuProgramCache)) {
- program_cache_.reset(new gpu::gles2::MemoryProgramCache());
+ !gpu_preferences().disable_gpu_program_cache) {
+ program_cache_.reset(new gpu::gles2::MemoryProgramCache(
+ gpu_preferences().gpu_program_cache_size,
+ gpu_preferences().disable_gpu_shader_disk_cache));
}
return program_cache_.get();
}
@@ -336,7 +345,8 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
decoder_.reset(gles2::GLES2Decoder::Create(
params.context_group
? params.context_group->decoder_->GetContextGroup()
- : new gles2::ContextGroup(service_->mailbox_manager(), NULL,
+ : new gles2::ContextGroup(service_->gpu_preferences(),
+ service_->mailbox_manager(), NULL,
service_->shader_translator_cache(),
service_->framebuffer_completeness_cache(),
NULL, service_->subscription_ref_set(),
@@ -1070,8 +1080,10 @@ bool GpuInProcessThread::UseVirtualizedGLContexts() {
scoped_refptr<gles2::ShaderTranslatorCache>
GpuInProcessThread::shader_translator_cache() {
- if (!shader_translator_cache_.get())
- shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache;
+ if (!shader_translator_cache_.get()) {
+ shader_translator_cache_ =
+ new gpu::gles2::ShaderTranslatorCache(gpu_preferences());
+ }
return shader_translator_cache_;
}
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/service/mailbox_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698