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

Unified Diff: base/android/library_loader/library_loader_hooks.cc

Issue 663543003: Fix low-memory devices crashing on Chrome start up during UMA recodring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
Index: base/android/library_loader/library_loader_hooks.cc
diff --git a/base/android/library_loader/library_loader_hooks.cc b/base/android/library_loader/library_loader_hooks.cc
index 819fe3df5e49486d5e2e53a5c0f0668ad69c7ca8..3db67cfb4eaf744e085a018d5bdcb252b9f6ecc5 100644
--- a/base/android/library_loader/library_loader_hooks.cc
+++ b/base/android/library_loader/library_loader_hooks.cc
@@ -51,7 +51,10 @@ enum LibraryLoadFromApkSupportCode {
NOT_SUPPORTED = 0,
SUPPORTED = 1,
- MAX_LIBRARY_LOAD_FROM_APK_SUPPORT_CODE = 2,
+ // The loader was unable to determine whether the funcionality is supported.
Ilya Sherman 2014/10/16 19:00:30 nit: "funcionality" -> "functionality"
petrcermak 2014/10/17 14:51:28 Done.
+ UNKNOWN = 2,
Ilya Sherman 2014/10/16 19:00:30 nit: I'd recommend moving this to be the first ite
petrcermak 2014/10/17 14:51:28 Done. It is very likely that more values will inde
+
+ MAX_LIBRARY_LOAD_FROM_APK_SUPPORT_CODE = 3,
};
picksi1 2014/10/17 08:23:24 You should probably have the enums named the same
petrcermak 2014/10/17 14:51:28 Done.
} // namespace
@@ -85,7 +88,7 @@ static void RecordChromiumAndroidLinkerBrowserHistogram(
jclass clazz,
jboolean is_using_browser_shared_relros,
jboolean load_at_fixed_address_failed,
- jboolean library_load_from_apk_supported) {
+ jint library_load_from_apk_support) {
// For low-memory devices, record whether or not we successfully loaded the
// browser at a fixed address. Otherwise just record a normal invocation.
BrowserHistogramCode histogram_code;
@@ -99,11 +102,13 @@ static void RecordChromiumAndroidLinkerBrowserHistogram(
histogram_code,
MAX_BROWSER_HISTOGRAM_CODE);
- // Record whether the device supports loading a library directly from the APK
- // file.
- UMA_HISTOGRAM_ENUMERATION("ChromiumAndroidLinker.LibraryLoadFromApkSupported",
- library_load_from_apk_supported ?
- SUPPORTED : NOT_SUPPORTED,
+ // Record the device support for loading a library directly from the APK file.
+ if (library_load_from_apk_support < 0 ||
+ library_load_from_apk_support >= MAX_LIBRARY_LOAD_FROM_APK_SUPPORT_CODE) {
+ library_load_from_apk_support = UNKNOWN;
picksi1 2014/10/17 08:23:24 Definitely replace the '0' with NOT_SUPPORTED enum
rmcilroy 2014/10/17 09:12:59 I actually think that might be more error prone si
picksi1 2014/10/17 09:23:51 If we ditched the default entry in the case statem
rmcilroy 2014/10/17 09:54:45 +1 this sounds good.
petrcermak 2014/10/17 14:51:28 Done.
petrcermak 2014/10/17 14:51:28 After a discussion with simonb, we concluded that
+ }
+ UMA_HISTOGRAM_ENUMERATION("ChromiumAndroidLinker.LibraryLoadFromApkSupport",
+ library_load_from_apk_support,
MAX_LIBRARY_LOAD_FROM_APK_SUPPORT_CODE);
}

Powered by Google App Engine
This is Rietveld 408576698