OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/android/sys_utils.h" | 5 #include "base/android/sys_utils.h" |
6 | 6 |
7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
8 #include "jni/SysUtils_jni.h" | 8 #include "jni/SysUtils_jni.h" |
9 | 9 |
10 const int64 kLowEndMemoryThreshold = 1024 * 1024 * 512; // 512 mb. | 10 // Any device that reports a physical RAM size less than this, in megabytes |
| 11 // is considered 'low-end'. IMPORTANT: Read the LinkerLowMemoryThresholdTest |
| 12 // comments in build/android/pylib/linker/test_case.py before modifying this |
| 13 // value. |
| 14 #define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB 512 |
| 15 |
| 16 const int64 kLowEndMemoryThreshold = |
| 17 1024 * 1024 * ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB; |
11 | 18 |
12 // Defined and called by JNI | 19 // Defined and called by JNI |
13 static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) { | 20 static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) { |
14 return base::android::SysUtils::IsLowEndDevice(); | 21 return base::android::SysUtils::IsLowEndDevice(); |
15 } | 22 } |
16 | 23 |
17 namespace base { | 24 namespace base { |
18 namespace android { | 25 namespace android { |
19 | 26 |
20 bool SysUtils::Register(JNIEnv* env) { | 27 bool SysUtils::Register(JNIEnv* env) { |
21 return RegisterNativesImpl(env); | 28 return RegisterNativesImpl(env); |
22 } | 29 } |
23 | 30 |
24 bool SysUtils::IsLowEndDevice() { | 31 bool SysUtils::IsLowEndDevice() { |
25 return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold; | 32 return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold; |
26 } | 33 } |
27 | 34 |
28 SysUtils::SysUtils() { } | 35 SysUtils::SysUtils() { } |
29 | 36 |
30 } // namespace android | 37 } // namespace android |
31 } // namespace base | 38 } // namespace base |
OLD | NEW |