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

Side by Side Diff: ui/gl/gl_context_android.cc

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « ui/gl/gl_bindings.h ('k') | ui/gl/gl_gl_api_implementation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gl/gl_context.h" 5 #include "ui/gl/gl_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 physical_memory_mb = std::max(dalvik_mb * 4, 113 physical_memory_mb = std::max(dalvik_mb * 4,
114 (physical_mb * 4) / 3); 114 (physical_mb * 4) / 3);
115 115
116 // Now we take a default of 1/8th of memory on high-memory devices, 116 // Now we take a default of 1/8th of memory on high-memory devices,
117 // and gradually scale that back for low-memory devices (to be nicer 117 // and gradually scale that back for low-memory devices (to be nicer
118 // to other apps so they don't get killed). Examples: 118 // to other apps so they don't get killed). Examples:
119 // Nexus 4/10(2GB) 256MB (normally 128MB) 119 // Nexus 4/10(2GB) 256MB (normally 128MB)
120 // Droid Razr M(1GB) 114MB (normally 57MB) 120 // Droid Razr M(1GB) 114MB (normally 57MB)
121 // Galaxy Nexus(1GB) 100MB (normally 50MB) 121 // Galaxy Nexus(1GB) 100MB (normally 50MB)
122 // Xoom(1GB) 100MB (normally 50MB) 122 // Xoom(1GB) 100MB (normally 50MB)
123 // Nexus S(low-end) 12MB (normally 8MB) 123 // Nexus S(low-end) 8MB (normally 8MB)
124 // Note that the compositor now uses only some of this memory for 124 // Note that the compositor now uses only some of this memory for
125 // pre-painting and uses the rest only for 'emergencies'. 125 // pre-painting and uses the rest only for 'emergencies'.
126 static size_t limit_bytes = 0; 126 static size_t limit_bytes = 0;
127 if (limit_bytes == 0) { 127 if (limit_bytes == 0) {
128 // NOTE: Non-low-end devices use only 50% of these limits, 128 // NOTE: Non-low-end devices use only 50% of these limits,
129 // except during 'emergencies' where 100% can be used. 129 // except during 'emergencies' where 100% can be used.
130 if (!base::SysInfo::IsLowEndDevice()) { 130 if (!base::SysInfo::IsLowEndDevice()) {
131 if (physical_memory_mb >= 1536) 131 if (physical_memory_mb >= 1536)
132 limit_bytes = physical_memory_mb / 8; // >192MB 132 limit_bytes = physical_memory_mb / 8; // >192MB
133 else if (physical_memory_mb >= 1152) 133 else if (physical_memory_mb >= 1152)
134 limit_bytes = physical_memory_mb / 8; // >144MB 134 limit_bytes = physical_memory_mb / 8; // >144MB
135 else if (physical_memory_mb >= 768) 135 else if (physical_memory_mb >= 768)
136 limit_bytes = physical_memory_mb / 10; // >76MB 136 limit_bytes = physical_memory_mb / 10; // >76MB
137 else 137 else
138 limit_bytes = physical_memory_mb / 12; // <64MB 138 limit_bytes = physical_memory_mb / 12; // <64MB
139 } else { 139 } else {
140 // Low-end devices have 512MB or less memory by definition 140 // Low-end devices have 512MB or less memory by definition
141 // so we hard code the limit rather than relying on the heuristics 141 // so we hard code the limit rather than relying on the heuristics
142 // above. Low-end devices use 4444 textures so we can use a lower limit. 142 // above. Low-end devices use 4444 textures so we can use a lower limit.
143 // NOTE: Low-end uses 2/3 (67%) of this memory in practice, so we have 143 limit_bytes = 8;
144 // increased the limit to 12 (8MB, or 12MB in emergencies).
145 limit_bytes = 12;
146 } 144 }
147 limit_bytes = limit_bytes * 1024 * 1024; 145 limit_bytes = limit_bytes * 1024 * 1024;
148 } 146 }
149 *bytes = limit_bytes; 147 *bytes = limit_bytes;
150 return true; 148 return true;
151 } 149 }
152 150
153 } 151 }
OLDNEW
« no previous file with comments | « ui/gl/gl_bindings.h ('k') | ui/gl/gl_gl_api_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698