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

Side by Side Diff: base/sys_info_android.cc

Issue 12223064: base: Fix parsing and add dalvik-heap-limit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 7 years, 10 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
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 "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <sys/system_properties.h> 7 #include <sys/system_properties.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 result = std::min<int64>(std::max<int64>(32, result), 1024); 72 result = std::min<int64>(std::max<int64>(32, result), 1024);
73 return static_cast<int>(result); 73 return static_cast<int>(result);
74 } 74 }
75 75
76 int GetDalvikHeapSizeMB() { 76 int GetDalvikHeapSizeMB() {
77 char heap_size_str[PROP_VALUE_MAX]; 77 char heap_size_str[PROP_VALUE_MAX];
78 __system_property_get("dalvik.vm.heapsize", heap_size_str); 78 __system_property_get("dalvik.vm.heapsize", heap_size_str);
79 return ParseHeapSize(heap_size_str); 79 return ParseHeapSize(heap_size_str);
80 } 80 }
81 81
82 int GetDalvikHeapGrowthLimitMB() {
83 char heap_size_str[PROP_VALUE_MAX];
84 __system_property_get("dalvik.vm.heapgrowthlimit", heap_size_str);
85 return ParseHeapSize(heap_size_str);
86 }
87
82 } // anonymous namespace 88 } // anonymous namespace
83 89
84 namespace base { 90 namespace base {
85 91
86 std::string SysInfo::OperatingSystemName() { 92 std::string SysInfo::OperatingSystemName() {
87 return "Android"; 93 return "Android";
88 } 94 }
89 95
90 std::string SysInfo::GetAndroidBuildCodename() { 96 std::string SysInfo::GetAndroidBuildCodename() {
91 char os_version_codename_str[PROP_VALUE_MAX]; 97 char os_version_codename_str[PROP_VALUE_MAX];
(...skipping 23 matching lines...) Expand all
115 // Parse out the numbers. 121 // Parse out the numbers.
116 ParseOSVersionNumbers(os_version_str, major_version, minor_version, 122 ParseOSVersionNumbers(os_version_str, major_version, minor_version,
117 bugfix_version); 123 bugfix_version);
118 } 124 }
119 125
120 int SysInfo::DalvikHeapSizeMB() { 126 int SysInfo::DalvikHeapSizeMB() {
121 static int heap_size = GetDalvikHeapSizeMB(); 127 static int heap_size = GetDalvikHeapSizeMB();
122 return heap_size; 128 return heap_size;
123 } 129 }
124 130
131 int SysInfo::DalvikHeapGrowthLimitMB() {
132 static int heap_growth_limit = GetDalvikHeapGrowthLimitMB();
133 return heap_growth_limit;
134 }
135
136
125 } // namespace base 137 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698