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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/child/webkitplatformsupport_impl.h ('k') | 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 "webkit/child/webkitplatformsupport_impl.h" 5 #include "webkit/child/webkitplatformsupport_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "third_party/WebKit/public/web/WebInputEvent.h" 44 #include "third_party/WebKit/public/web/WebInputEvent.h"
45 #include "third_party/WebKit/public/web/WebScreenInfo.h" 45 #include "third_party/WebKit/public/web/WebScreenInfo.h"
46 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 46 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
47 #include "ui/base/layout.h" 47 #include "ui/base/layout.h"
48 #include "webkit/child/webkit_child_helpers.h" 48 #include "webkit/child/webkit_child_helpers.h"
49 #include "webkit/child/websocketstreamhandle_impl.h" 49 #include "webkit/child/websocketstreamhandle_impl.h"
50 #include "webkit/child/weburlloader_impl.h" 50 #include "webkit/child/weburlloader_impl.h"
51 #include "webkit/common/user_agent/user_agent.h" 51 #include "webkit/common/user_agent/user_agent.h"
52 #include "webkit/glue/webkit_glue.h" 52 #include "webkit/glue/webkit_glue.h"
53 53
54 #if defined(OS_ANDROID)
55 #include "base/android/sys_utils.h"
56 #endif
57
54 using WebKit::WebAudioBus; 58 using WebKit::WebAudioBus;
55 using WebKit::WebCookie; 59 using WebKit::WebCookie;
56 using WebKit::WebData; 60 using WebKit::WebData;
57 using WebKit::WebLocalizedString; 61 using WebKit::WebLocalizedString;
58 using WebKit::WebPluginListBuilder; 62 using WebKit::WebPluginListBuilder;
59 using WebKit::WebString; 63 using WebKit::WebString;
60 using WebKit::WebSocketStreamHandle; 64 using WebKit::WebSocketStreamHandle;
61 using WebKit::WebURL; 65 using WebKit::WebURL;
62 using WebKit::WebURLError; 66 using WebKit::WebURLError;
63 using WebKit::WebURLLoader; 67 using WebKit::WebURLLoader;
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( 876 bool WebKitPlatformSupportImpl::processMemorySizesInBytes(
873 size_t* private_bytes, 877 size_t* private_bytes,
874 size_t* shared_bytes) { 878 size_t* shared_bytes) {
875 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); 879 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes);
876 } 880 }
877 881
878 bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) { 882 bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) {
879 return base::allocator::GetAllocatorWasteSize(size); 883 return base::allocator::GetAllocatorWasteSize(size);
880 } 884 }
881 885
886 size_t WebKitPlatformSupportImpl::maxImageDecodedBytes() {
887 #if defined(OS_ANDROID)
888 // Limit image decoded size to 3M pixels on low end devices.
889 if (base::android::SysUtils::IsLowEndDevice())
890 return 3 * 1000 * 1000 * 4; // 4 is maximum number of bytes per pixel.
891 #endif
892 return 0; // Unlimited.
tony 2013/09/20 22:27:04 Having 0 mean unlimited is a bit weird. Why not r
Xianzhu 2013/09/20 23:13:47 Done.
893 }
894
882 void WebKitPlatformSupportImpl::SuspendSharedTimer() { 895 void WebKitPlatformSupportImpl::SuspendSharedTimer() {
883 ++shared_timer_suspended_; 896 ++shared_timer_suspended_;
884 } 897 }
885 898
886 void WebKitPlatformSupportImpl::ResumeSharedTimer() { 899 void WebKitPlatformSupportImpl::ResumeSharedTimer() {
887 // The shared timer may have fired or been adjusted while we were suspended. 900 // The shared timer may have fired or been adjusted while we were suspended.
888 if (--shared_timer_suspended_ == 0 && 901 if (--shared_timer_suspended_ == 0 &&
889 (!shared_timer_.IsRunning() || 902 (!shared_timer_.IsRunning() ||
890 shared_timer_fire_time_was_set_while_suspended_)) { 903 shared_timer_fire_time_was_set_while_suspended_)) {
891 shared_timer_fire_time_was_set_while_suspended_ = false; 904 shared_timer_fire_time_was_set_while_suspended_ = false;
892 setSharedTimerFireInterval( 905 setSharedTimerFireInterval(
893 shared_timer_fire_time_ - monotonicallyIncreasingTime()); 906 shared_timer_fire_time_ - monotonicallyIncreasingTime());
894 } 907 }
895 } 908 }
896 909
897 } // namespace webkit_glue 910 } // namespace webkit_glue
OLDNEW
« 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