summaryrefslogtreecommitdiffstats
path: root/base/android/sys_utils.cc
diff options
context:
space:
mode:
authordigit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-08 01:04:57 +0000
committerdigit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-08 01:04:57 +0000
commit095e4dc9888210cb153f712830e7f07e8c9c9a51 (patch)
tree8524937dae2c4ce3986362f1cb28d455ec356c42 /base/android/sys_utils.cc
parentf0ad54cdb589d9054b86f49872d338b682ba590d (diff)
downloadchromium_src-095e4dc9888210cb153f712830e7f07e8c9c9a51.zip
chromium_src-095e4dc9888210cb153f712830e7f07e8c9c9a51.tar.gz
chromium_src-095e4dc9888210cb153f712830e7f07e8c9c9a51.tar.bz2
android: Make org.chromium.base.SysUtils.isLowEndDevice() work without native code.
This patch modifies the implementation if SysUtils.isLowEndDevice() to not rely on any native code, which is required to run it before the native libraries are actually loaded (e.g. when running certain tests). + Simplify the content linker that doesn't need a specific native method anymore to replicate the yet-unloaded native SysUtils::IsLowEndDevice(). BUG=309926 R=dtrainor@chromium.org,tedchoc@chromium.org,frankf@chromium.org,bulach@chromium.org TEST=build/android/test_runner.py linker Review URL: https://codereview.chromium.org/59033008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android/sys_utils.cc')
-rw-r--r--base/android/sys_utils.cc26
1 files changed, 7 insertions, 19 deletions
diff --git a/base/android/sys_utils.cc b/base/android/sys_utils.cc
index 2a7db19..103324d 100644
--- a/base/android/sys_utils.cc
+++ b/base/android/sys_utils.cc
@@ -8,23 +8,6 @@
#include "base/sys_info.h"
#include "jni/SysUtils_jni.h"
-// Any device that reports a physical RAM size less than this, in megabytes
-// is considered 'low-end'. IMPORTANT: Read the LinkerLowMemoryThresholdTest
-// comments in build/android/pylib/linker/test_case.py before modifying this
-// value.
-#define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB 512
-
-const int64 kLowEndMemoryThreshold =
- 1024 * 1024 * ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB;
-
-// Only support low end device changes on builds greater than JB MR2.
-const int kLowEndSdkIntThreshold = 18;
-
-// Defined and called by JNI
-static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) {
- return base::android::SysUtils::IsLowEndDevice();
-}
-
namespace base {
namespace android {
@@ -33,8 +16,13 @@ bool SysUtils::Register(JNIEnv* env) {
}
bool SysUtils::IsLowEndDevice() {
- return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold &&
- BuildInfo::GetInstance()->sdk_int() > kLowEndSdkIntThreshold;
+ JNIEnv* env = AttachCurrentThread();
+ return Java_SysUtils_isLowEndDevice(env);
+}
+
+size_t SysUtils::AmountOfPhysicalMemoryKB() {
+ JNIEnv* env = AttachCurrentThread();
+ return static_cast<size_t>(Java_SysUtils_amountOfPhysicalMemoryKB(env));
}
SysUtils::SysUtils() { }