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

Unified Diff: content/common/android/linker/linker_jni.cc

Issue 59033008: android: Make org.chromium.base.SysUtils.isLowEndDevice() work without native code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/common/android/linker/linker_jni.cc
diff --git a/content/common/android/linker/linker_jni.cc b/content/common/android/linker/linker_jni.cc
index 4254defef0acf5cd1543ca4b959bff75fab819ec..7db9fea48e2cc05baf353c4b6e623f8beb093003 100644
--- a/content/common/android/linker/linker_jni.cc
+++ b/content/common/android/linker/linker_jni.cc
@@ -19,12 +19,6 @@
#include <stdlib.h>
#include <unistd.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
-
// Set this to 1 to enable debug traces to the Android log.
// Note that LOG() from "base/logging.h" cannot be used, since it is
// in base/ which hasn't been loaded yet.
@@ -388,30 +382,6 @@ jlong GetPageSize(JNIEnv* env, jclass clazz) {
return result;
}
-jboolean IsLowMemoryDevice(JNIEnv* env, jclass clazz) {
- // This matches the implementation of org.chromium.base.SysUtils.isLowEnd(),
- // however this Java method relies on native code from base/, which isn't
- // available since the library hasn't been loaded yet.
- // The value ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB is the same for both
- // sources.
-
- // Threshold for low-end memory devices.
- const size_t kMegaBytes = 1024 * 1024;
- const size_t kLowMemoryDeviceThreshold =
- ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB * kMegaBytes;
-
- // Compute the amount of physical RAM on the device.
- size_t pages = static_cast<size_t>(sysconf(_SC_PHYS_PAGES));
- size_t page_size = static_cast<size_t>(sysconf(_SC_PAGESIZE));
- size_t physical_size = pages * page_size;
-
- LOG_INFO("%s: System physical size is %zu MB\n",
- __FUNCTION__,
- physical_size / kMegaBytes);
-
- return physical_size <= kLowMemoryDeviceThreshold;
-}
-
const JNINativeMethod kNativeMethods[] = {
{"nativeLoadLibrary",
"("
@@ -445,12 +415,7 @@ const JNINativeMethod kNativeMethods[] = {
"("
")"
"J",
- reinterpret_cast<void*>(&GetPageSize)},
- {"nativeIsLowMemoryDevice",
- "("
- ")"
- "Z",
- reinterpret_cast<void*>(&IsLowMemoryDevice)}, };
+ reinterpret_cast<void*>(&GetPageSize)}, };
} // namespace

Powered by Google App Engine
This is Rietveld 408576698