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

Unified Diff: webkit/child/webkitplatformsupport_impl.cc

Issue 23600067: Limit image decoded size on low end Android devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 0 -> max size_t for Unlimited Created 7 years, 3 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 | « webkit/child/webkitplatformsupport_impl.h ('k') | 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
diff --git a/webkit/child/webkitplatformsupport_impl.cc b/webkit/child/webkitplatformsupport_impl.cc
index 50c9a787d4ac800dbb2a7ae1b38e2326ddac6e9b..6fb30d1c76f148ead7397f2102200a154361c52f 100644
--- a/webkit/child/webkitplatformsupport_impl.cc
+++ b/webkit/child/webkitplatformsupport_impl.cc
@@ -51,6 +51,10 @@
#include "webkit/common/user_agent/user_agent.h"
#include "webkit/glue/webkit_glue.h"
+#if defined(OS_ANDROID)
+#include "base/android/sys_utils.h"
+#endif
+
using WebKit::WebAudioBus;
using WebKit::WebCookie;
using WebKit::WebData;
@@ -879,6 +883,15 @@ bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) {
return base::allocator::GetAllocatorWasteSize(size);
}
+size_t WebKitPlatformSupportImpl::maxImageDecodedBytes() {
+#if defined(OS_ANDROID)
+ // Limit image decoded size to 3M pixels on low end devices.
+ if (base::android::SysUtils::IsLowEndDevice())
+ return 3 * 1000 * 1000 * 4; // 4 is maximum number of bytes per pixel.
tony 2013/09/20 23:14:57 Nit: Why 1000 instead of 1024?
Xianzhu 2013/09/20 23:23:56 Just followed the same behavior of iOS browser. Ag
+#endif
+ return std::numeric_limits<size_t>::max(); // Unlimited.
+}
+
void WebKitPlatformSupportImpl::SuspendSharedTimer() {
++shared_timer_suspended_;
}
« no previous file with comments | « webkit/child/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698