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

Unified Diff: gpu/command_buffer/service/memory_program_cache.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/memory_program_cache.cc
diff --git a/gpu/command_buffer/service/memory_program_cache.cc b/gpu/command_buffer/service/memory_program_cache.cc
index 3d6876f5b412fea5c2a09d456fe7ad3bee711cb5..2653b1f386868a51a13e93bd6ab22bf29a7e61a2 100644
--- a/gpu/command_buffer/service/memory_program_cache.cc
+++ b/gpu/command_buffer/service/memory_program_cache.cc
@@ -16,27 +16,10 @@
#include "gpu/command_buffer/service/disk_cache_proto.pb.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/command_buffer/service/gpu_switches.h"
+#include "gpu/command_buffer/service/gpu_preferences.h"
#include "gpu/command_buffer/service/shader_manager.h"
#include "ui/gl/gl_bindings.h"
-namespace {
-
-size_t GetCacheSizeBytes() {
- const base::CommandLine* command_line =
- base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kGpuProgramCacheSizeKb)) {
- size_t size;
- if (base::StringToSizeT(
- command_line->GetSwitchValueNative(switches::kGpuProgramCacheSizeKb),
- &size))
- return size * 1024;
- }
- return gpu::kDefaultMaxProgramCacheMemoryBytes;
-}
-
-} // anonymous namespace
-
namespace gpu {
namespace gles2 {
@@ -167,7 +150,7 @@ void RunShaderCallback(const ShaderCacheCallback& callback,
} // namespace
MemoryProgramCache::MemoryProgramCache()
- : max_size_bytes_(GetCacheSizeBytes()),
+ : max_size_bytes_(GpuPreferences::GetInstance()->gpu_program_cache_size),
curr_size_bytes_(0),
store_(ProgramMRUCache::NO_AUTO_EVICT) {
}
@@ -235,8 +218,7 @@ ProgramCache::ProgramLoadResult MemoryProgramCache::LoadLinkedProgram(
shader_b->set_output_variable_list(value->output_variable_list_1());
if (!shader_callback.is_null() &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuShaderDiskCache)) {
+ !GpuPreferences::GetInstance()->disable_gpu_shader_disk_cache) {
scoped_ptr<GpuProgramProto> proto(
GpuProgramProto::default_instance().New());
proto->set_sha(sha, kHashLength);
@@ -306,8 +288,7 @@ void MemoryProgramCache::SaveLinkedProgram(
}
if (!shader_callback.is_null() &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuShaderDiskCache)) {
+ !GpuPreferences::GetInstance()->disable_gpu_shader_disk_cache) {
scoped_ptr<GpuProgramProto> proto(
GpuProgramProto::default_instance().New());
proto->set_sha(sha, kHashLength);

Powered by Google App Engine
This is Rietveld 408576698