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

Unified Diff: base/android/sys_utils.cc

Issue 17151011: Add a method for catching low end devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/sys_utils.h ('k') | base/base.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/sys_utils.cc
diff --git a/base/android/sys_utils.cc b/base/android/sys_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c23125390dab446885527f5f57b2bf11d692c455
--- /dev/null
+++ b/base/android/sys_utils.cc
@@ -0,0 +1,31 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/android/sys_utils.h"
+
+#include "base/sys_info.h"
+#include "jni/SysUtils_jni.h"
+
+const int64 kLowEndMemoryThreshold = 1024 * 1024 * 512; // 512 mb.
+
+// Defined and called by JNI
+static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) {
+ return base::android::SysUtils::IsLowEndDevice();
+}
+
+namespace base {
+namespace android {
+
+bool SysUtils::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+bool SysUtils::IsLowEndDevice() {
+ return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold;
+}
+
+SysUtils::SysUtils() { }
+
+} // namespace android
+} // namespace base
« no previous file with comments | « base/android/sys_utils.h ('k') | base/base.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698