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

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

Issue 119493005: Expose a low-end device mode override flags for non-android OSs as well (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
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/android/sys_utils.h"
8 #include "base/logging.h" 7 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
10 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "base/sys_utils.h"
11 #include "ui/gl/gl_bindings.h" 11 #include "ui/gl/gl_bindings.h"
12 #include "ui/gl/gl_context_egl.h" 12 #include "ui/gl/gl_context_egl.h"
13 #include "ui/gl/gl_context_stub.h" 13 #include "ui/gl/gl_context_stub.h"
14 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
15 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 18
19 namespace { 19 namespace {
20 20
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Now we take a default of 1/8th of memory on high-memory devices, 108 // Now we take a default of 1/8th of memory on high-memory devices,
109 // and gradually scale that back for low-memory devices (to be nicer 109 // and gradually scale that back for low-memory devices (to be nicer
110 // to other apps so they don't get killed). Examples: 110 // to other apps so they don't get killed). Examples:
111 // Nexus 4/10(2GB) 256MB 111 // Nexus 4/10(2GB) 256MB
112 // Droid Razr M(1GB) 91MB 112 // Droid Razr M(1GB) 91MB
113 // Galaxy Nexus(1GB) 85MB 113 // Galaxy Nexus(1GB) 85MB
114 // Xoom(1GB) 85MB 114 // Xoom(1GB) 85MB
115 // Nexus S(low-end) 8MB 115 // Nexus S(low-end) 8MB
116 static size_t limit_bytes = 0; 116 static size_t limit_bytes = 0;
117 if (limit_bytes == 0) { 117 if (limit_bytes == 0) {
118 if (!base::android::SysUtils::IsLowEndDevice()) { 118 if (!base::SysUtils::IsLowEndDevice()) {
119 if (physical_memory_mb >= 1536) 119 if (physical_memory_mb >= 1536)
120 limit_bytes = physical_memory_mb / 8; 120 limit_bytes = physical_memory_mb / 8;
121 else if (physical_memory_mb >= 1152) 121 else if (physical_memory_mb >= 1152)
122 limit_bytes = physical_memory_mb / 10; 122 limit_bytes = physical_memory_mb / 10;
123 else if (physical_memory_mb >= 768) 123 else if (physical_memory_mb >= 768)
124 limit_bytes = physical_memory_mb / 12; 124 limit_bytes = physical_memory_mb / 12;
125 else 125 else
126 limit_bytes = physical_memory_mb / 16; 126 limit_bytes = physical_memory_mb / 16;
127 } else { 127 } else {
128 // Low-end devices have 512MB or less memory by definition 128 // Low-end devices have 512MB or less memory by definition
129 // so we hard code the limit rather than relying on the heuristics 129 // so we hard code the limit rather than relying on the heuristics
130 // above. Low-end devices use 4444 textures so we can use a lower limit. 130 // above. Low-end devices use 4444 textures so we can use a lower limit.
131 limit_bytes = 8; 131 limit_bytes = 8;
132 } 132 }
133 limit_bytes = limit_bytes * 1024 * 1024; 133 limit_bytes = limit_bytes * 1024 * 1024;
134 } 134 }
135 *bytes = limit_bytes; 135 *bytes = limit_bytes;
136 return true; 136 return true;
137 } 137 }
138 138
139 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698