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

Unified Diff: webkit/child/webkitplatformsupport_impl.cc

Issue 26282002: Merge 227063 "Android: limit image decoded size based on amount ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1650/src/
Patch Set: Created 7 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
« 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: webkit/child/webkitplatformsupport_impl.cc
===================================================================
--- webkit/child/webkitplatformsupport_impl.cc (revision 227290)
+++ webkit/child/webkitplatformsupport_impl.cc (working copy)
@@ -24,6 +24,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
+#include "base/sys_info.h"
#include "base/time/time.h"
#include "content/public/common/webplugininfo.h"
#include "grit/blink_resources.h"
@@ -889,11 +890,17 @@
size_t WebKitPlatformSupportImpl::maxDecodedImageBytes() {
#if defined(OS_ANDROID)
- // Limit image decoded size to 3M pixels on low end devices.
- if (base::android::SysUtils::IsLowEndDevice())
- return 3 * 1024 * 1024 * 4; // 4 is maximum number of bytes per pixel.
+ if (base::android::SysUtils::IsLowEndDevice()) {
+ // Limit image decoded size to 3M pixels on low end devices.
+ // 4 is maximum number of bytes per pixel.
+ return 3 * 1024 * 1024 * 4;
+ }
+ // For other devices, limit decoded image size based on the amount of physical
+ // memory. For a device with 2GB physical memory the limit is 16M pixels.
+ return base::SysInfo::AmountOfPhysicalMemory() / 32;
+#else
+ return noDecodedImageByteLimit;
#endif
- return noDecodedImageByteLimit;
}
void WebKitPlatformSupportImpl::SuspendSharedTimer() {
« 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