Chromium Code Reviews| Index: gpu/skia_bindings/grcontext_for_gles2_interface.cc |
| diff --git a/gpu/skia_bindings/grcontext_for_gles2_interface.cc b/gpu/skia_bindings/grcontext_for_gles2_interface.cc |
| index 1f161413640323a6f505a0557e71f7f5263d5bfa..01a4686409655abe5d46a5b0d87b94e5bbe821da 100644 |
| --- a/gpu/skia_bindings/grcontext_for_gles2_interface.cc |
| +++ b/gpu/skia_bindings/grcontext_for_gles2_interface.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/lazy_instance.h" |
| #include "base/macros.h" |
| +#include "base/sys_info.h" |
| #include "base/trace_event/trace_event.h" |
| #include "gpu/command_buffer/client/gles2_interface.h" |
| #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
| @@ -32,10 +33,21 @@ GrContextForGLES2Interface::GrContextForGLES2Interface( |
| static const int kMaxGaneshResourceCacheCount = 16384; |
| // The limit of the bytes allocated toward GPU resources in the GrContext's |
| // GPU cache. |
| + static const size_t kMaxLowEndGaneshResourceCacheBytes = 48 * 1024 * 1024; |
| static const size_t kMaxGaneshResourceCacheBytes = 96 * 1024 * 1024; |
| + static const size_t kMaxHighEndGaneshResourceCacheBytes = 256 * 1024 * 1024; |
| + static const int64_t kHighEndMemoryThreshold = (int64_t)4096 * 1024 * 1024; |
| + |
| + size_t max_ganesh_resource_cache_bytes = kMaxGaneshResourceCacheBytes; |
| + if (base::SysInfo::IsLowEndDevice()) { |
|
ericrk
2017/04/26 00:49:31
Note that on Android O IsLowEndDevice applies to 1
|
| + max_ganesh_resource_cache_bytes = kMaxLowEndGaneshResourceCacheBytes; |
| + } else if (base::SysInfo::AmountOfPhysicalMemory() >= |
| + kHighEndMemoryThreshold) { |
| + max_ganesh_resource_cache_bytes = kMaxHighEndGaneshResourceCacheBytes; |
| + } |
| gr_context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount, |
| - kMaxGaneshResourceCacheBytes); |
| + max_ganesh_resource_cache_bytes); |
| } |
| } |