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

Unified Diff: ui/gl/gl_context_android.cc

Issue 1420533009: Cleanup GpuMemoryManager and helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup. Created 5 years, 1 month 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
« no previous file with comments | « ui/gl/gl_context.cc ('k') | ui/gl/gl_context_cgl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context_android.cc
diff --git a/ui/gl/gl_context_android.cc b/ui/gl/gl_context_android.cc
index ebf1dda6b13a8486e7f5c60acb74140da8a7e7ba..46f281b4e4d2541a762d2907064d976d1953c028 100644
--- a/ui/gl/gl_context_android.cc
+++ b/ui/gl/gl_context_android.cc
@@ -95,56 +95,4 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(
return context;
}
-bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) {
- DCHECK(bytes);
- *bytes = 0;
-
- // We can't query available GPU memory from the system on Android.
- // Physical memory is also mis-reported sometimes (eg. Nexus 10 reports
- // 1262MB when it actually has 2GB, while Razr M has 1GB but only reports
- // 128MB java heap size). First we estimate physical memory using both.
- size_t dalvik_mb = base::SysInfo::DalvikHeapSizeMB();
- size_t physical_mb = base::SysInfo::AmountOfPhysicalMemoryMB();
- size_t physical_memory_mb = 0;
- if (dalvik_mb >= 256)
- physical_memory_mb = dalvik_mb * 4;
- else
- physical_memory_mb = std::max(dalvik_mb * 4,
- (physical_mb * 4) / 3);
-
- // Now we take a default of 1/8th of memory on high-memory devices,
- // and gradually scale that back for low-memory devices (to be nicer
- // to other apps so they don't get killed). Examples:
- // Nexus 4/10(2GB) 256MB (normally 128MB)
- // Droid Razr M(1GB) 114MB (normally 57MB)
- // Galaxy Nexus(1GB) 100MB (normally 50MB)
- // Xoom(1GB) 100MB (normally 50MB)
- // Nexus S(low-end) 8MB (normally 8MB)
- // Note that the compositor now uses only some of this memory for
- // pre-painting and uses the rest only for 'emergencies'.
- static size_t limit_bytes = 0;
- if (limit_bytes == 0) {
- // NOTE: Non-low-end devices use only 50% of these limits,
- // except during 'emergencies' where 100% can be used.
- if (!base::SysInfo::IsLowEndDevice()) {
- if (physical_memory_mb >= 1536)
- limit_bytes = physical_memory_mb / 8; // >192MB
- else if (physical_memory_mb >= 1152)
- limit_bytes = physical_memory_mb / 8; // >144MB
- else if (physical_memory_mb >= 768)
- limit_bytes = physical_memory_mb / 10; // >76MB
- else
- limit_bytes = physical_memory_mb / 12; // <64MB
- } else {
- // Low-end devices have 512MB or less memory by definition
- // so we hard code the limit rather than relying on the heuristics
- // above. Low-end devices use 4444 textures so we can use a lower limit.
- limit_bytes = 8;
- }
- limit_bytes = limit_bytes * 1024 * 1024;
- }
- *bytes = limit_bytes;
- return true;
-}
-
}
« no previous file with comments | « ui/gl/gl_context.cc ('k') | ui/gl/gl_context_cgl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698