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

Unified Diff: base/sys_info_android.cc

Issue 1769503002: Add check for Java VM in Android's SysInfo::IsLowEndDevice() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted back to is vm check, updated comment Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_android.cc
diff --git a/base/sys_info_android.cc b/base/sys_info_android.cc
index cb25cdc51a3817c7fb2e9fc5a96781164ac0c6b8..bc0e3fa80dafb2e2345a87b786b817ea5a210a44 100644
--- a/base/sys_info_android.cc
+++ b/base/sys_info_android.cc
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <sys/system_properties.h>
+#include "base/android/jni_android.h"
#include "base/android/sys_utils.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -215,6 +216,17 @@ static base::LazyInstance<
g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER;
bool SysInfo::IsLowEndDevice() {
+ // This code might be used in some environments
+ // which might not have a Java environment.
+ // Note that we need to call the Java version here.
+ // There exists a complete native implementation in
+ // sys_info.cc but calling that here would mean that
+ // the Java code and the native code would call different
+ // implementations which could give different results.
+ // Also the Java code cannot depend on the native code
+ // since it might not be loaded yet.
+ if (!base::android::IsVMInitialized())
+ return false;
return g_lazy_low_end_device.Get().value();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698