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

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

Issue 16023006: ui: Make dalvik_limit static so that its value is cached across calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // end devices, 1/2 of the heap size can be too high, but this 89 // end devices, 1/2 of the heap size can be too high, but this
90 // correlates well with having a small heap-growth-limit. So for 90 // correlates well with having a small heap-growth-limit. So for
91 // devices with less ram, we factor in the growth limit. 91 // devices with less ram, we factor in the growth limit.
92 // 92 //
93 // This is the result of the calculation below: 93 // This is the result of the calculation below:
94 // Droid DNA 1080P 128MB 94 // Droid DNA 1080P 128MB
95 // Nexus S 56MB 95 // Nexus S 56MB
96 // Galaxy Nexus 112MB 96 // Galaxy Nexus 112MB
97 // Nexus 4/10 256MB 97 // Nexus 4/10 256MB
98 // Xoom 88MB 98 // Xoom 88MB
99 size_t dalvik_limit = 0; 99 static size_t dalvik_limit = 0;
100 if (!dalvik_limit) { 100 if (!dalvik_limit) {
101 size_t heap_size = static_cast<size_t>(base::SysInfo::DalvikHeapSizeMB()); 101 size_t heap_size = static_cast<size_t>(base::SysInfo::DalvikHeapSizeMB());
102 size_t heap_growth = static_cast<size_t>( 102 size_t heap_growth = static_cast<size_t>(
103 base::SysInfo::DalvikHeapGrowthLimitMB()); 103 base::SysInfo::DalvikHeapGrowthLimitMB());
104 size_t limit = 0; 104 size_t limit = 0;
105 if (heap_size >= 350) 105 if (heap_size >= 350)
106 limit = heap_size / 2; 106 limit = heap_size / 2;
107 else 107 else
108 limit = (heap_size + (heap_growth * 2)) / 4; 108 limit = (heap_size + (heap_growth * 2)) / 4;
109 dalvik_limit = limit * 1024 * 1024; 109 dalvik_limit = limit * 1024 * 1024;
110 } 110 }
111 *bytes = dalvik_limit; 111 *bytes = dalvik_limit;
112 return true; 112 return true;
113 } 113 }
114 114
115 } 115 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698