OLD | NEW |
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 Loading... |
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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( | 880 bool WebKitPlatformSupportImpl::processMemorySizesInBytes( |
877 size_t* private_bytes, | 881 size_t* private_bytes, |
878 size_t* shared_bytes) { | 882 size_t* shared_bytes) { |
879 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); | 883 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); |
880 } | 884 } |
881 | 885 |
882 bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) { | 886 bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) { |
883 return base::allocator::GetAllocatorWasteSize(size); | 887 return base::allocator::GetAllocatorWasteSize(size); |
884 } | 888 } |
885 | 889 |
| 890 size_t WebKitPlatformSupportImpl::maxDecodedImageBytes() { |
| 891 #if defined(OS_ANDROID) |
| 892 // Limit image decoded size to 3M pixels on low end devices. |
| 893 if (base::android::SysUtils::IsLowEndDevice()) |
| 894 return 3 * 1024 * 1024 * 4; // 4 is maximum number of bytes per pixel. |
| 895 #endif |
| 896 return noDecodedImageByteLimit; |
| 897 } |
| 898 |
886 void WebKitPlatformSupportImpl::SuspendSharedTimer() { | 899 void WebKitPlatformSupportImpl::SuspendSharedTimer() { |
887 ++shared_timer_suspended_; | 900 ++shared_timer_suspended_; |
888 } | 901 } |
889 | 902 |
890 void WebKitPlatformSupportImpl::ResumeSharedTimer() { | 903 void WebKitPlatformSupportImpl::ResumeSharedTimer() { |
891 // The shared timer may have fired or been adjusted while we were suspended. | 904 // The shared timer may have fired or been adjusted while we were suspended. |
892 if (--shared_timer_suspended_ == 0 && | 905 if (--shared_timer_suspended_ == 0 && |
893 (!shared_timer_.IsRunning() || | 906 (!shared_timer_.IsRunning() || |
894 shared_timer_fire_time_was_set_while_suspended_)) { | 907 shared_timer_fire_time_was_set_while_suspended_)) { |
895 shared_timer_fire_time_was_set_while_suspended_ = false; | 908 shared_timer_fire_time_was_set_while_suspended_ = false; |
896 setSharedTimerFireInterval( | 909 setSharedTimerFireInterval( |
897 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 910 shared_timer_fire_time_ - monotonicallyIncreasingTime()); |
898 } | 911 } |
899 } | 912 } |
900 | 913 |
901 } // namespace webkit_glue | 914 } // namespace webkit_glue |
OLD | NEW |