commit | 61e3cc82e28784b99b9200e4134f570530ea1623 | [log] [tgz] |
---|---|---|
author | Rulong Chen(陈汝龙) <[email protected]> | Sat Aug 29 03:29:25 2020 |
committer | Commit Bot <[email protected]> | Sat Aug 29 03:29:25 2020 |
tree | b18b85fc56541e3cae09bcc5e945a0c69c6816d6 | |
parent | 79d065d7fabdb164567f71d063f6a09e6a4f1422 [diff] [blame] |
[aw] Allow Bitmap allocations to fail without OOM crashing. One large favicon might cause an OOM crash when it is converted to a Java-backed Bitmap in Android. Failing to render the favicon still seems preferable than *ever* crash here. [email protected],[email protected] Bug: 1112794 Change-Id: Idca46d2e1484ce4538b79e8df6910de7b18ef1f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376929 Commit-Queue: Bo <[email protected]> Reviewed-by: Richard Coles <[email protected]> Reviewed-by: Bo <[email protected]> Cr-Commit-Position: refs/heads/master@{#802876}
diff --git a/content/browser/frame_host/navigation_controller_android.cc b/content/browser/frame_host/navigation_controller_android.cc index 075eb31..4d8453b3 100644 --- a/content/browser/frame_host/navigation_controller_android.cc +++ b/content/browser/frame_host/navigation_controller_android.cc
@@ -56,8 +56,10 @@ ConvertUTF8ToJavaString(env, entry->GetReferrer().url.spec())); ScopedJavaLocalRef<jobject> j_bitmap; const content::FaviconStatus& status = entry->GetFavicon(); - if (status.valid && status.image.ToSkBitmap()->computeByteSize() > 0) - j_bitmap = gfx::ConvertToJavaBitmap(status.image.ToSkBitmap()); + if (status.valid && status.image.ToSkBitmap()->computeByteSize() > 0) { + j_bitmap = gfx::ConvertToJavaBitmap(status.image.ToSkBitmap(), + gfx::OomBehavior::kReturnNullOnOom); + } jlong j_timestamp = entry->GetTimestamp().ToJavaTime(); return content::Java_NavigationControllerImpl_createNavigationEntry(