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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <sys/system_properties.h> 10 #include <sys/system_properties.h>
11 11
12 #include "base/android/jni_android.h"
12 #include "base/android/sys_utils.h" 13 #include "base/android/sys_utils.h"
13 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
17 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
18 #include "base/sys_info_internal.h" 19 #include "base/sys_info_internal.h"
19 20
20 #if (__ANDROID_API__ >= 21 /* 5.0 - Lollipop */) 21 #if (__ANDROID_API__ >= 21 /* 5.0 - Lollipop */)
21 22
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 static int heap_growth_limit = GetDalvikHeapGrowthLimitMB(); 209 static int heap_growth_limit = GetDalvikHeapGrowthLimitMB();
209 return heap_growth_limit; 210 return heap_growth_limit;
210 } 211 }
211 212
212 static base::LazyInstance< 213 static base::LazyInstance<
213 base::internal::LazySysInfoValue<bool, 214 base::internal::LazySysInfoValue<bool,
214 android::SysUtils::IsLowEndDeviceFromJni> >::Leaky 215 android::SysUtils::IsLowEndDeviceFromJni> >::Leaky
215 g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; 216 g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER;
216 217
217 bool SysInfo::IsLowEndDevice() { 218 bool SysInfo::IsLowEndDevice() {
219 // This code might be used in some environments
220 // which might not have a Java environment.
221 // Note that we need to call the Java version here.
222 // There exists a complete native implementation in
223 // sys_info.cc but calling that here would mean that
224 // the Java code and the native code would call different
225 // implementations which could give different results.
226 // Also the Java code cannot depend on the native code
227 // since it might not be loaded yet.
228 if (!base::android::IsVMInitialized())
229 return false;
218 return g_lazy_low_end_device.Get().value(); 230 return g_lazy_low_end_device.Get().value();
219 } 231 }
220 232
221 233
222 } // namespace base 234 } // namespace base
OLDNEW
« 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