OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "net/base/data_url.h" | 41 #include "net/base/data_url.h" |
42 #include "net/base/mime_util.h" | 42 #include "net/base/mime_util.h" |
43 #include "net/base/net_errors.h" | 43 #include "net/base/net_errors.h" |
44 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" | 44 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" |
45 #include "third_party/WebKit/public/platform/WebData.h" | 45 #include "third_party/WebKit/public/platform/WebData.h" |
46 #include "third_party/WebKit/public/platform/WebString.h" | 46 #include "third_party/WebKit/public/platform/WebString.h" |
47 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 47 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
48 #include "ui/base/layout.h" | 48 #include "ui/base/layout.h" |
49 | 49 |
50 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
51 #include "base/android/sys_utils.h" | |
52 #include "content/child/fling_animator_impl_android.h" | 51 #include "content/child/fling_animator_impl_android.h" |
53 #endif | 52 #endif |
54 | 53 |
55 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) | 54 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) |
56 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 55 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
57 #endif | 56 #endif |
58 | 57 |
59 using blink::WebData; | 58 using blink::WebData; |
60 using blink::WebFallbackThemeEngine; | 59 using blink::WebFallbackThemeEngine; |
61 using blink::WebLocalizedString; | 60 using blink::WebLocalizedString; |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { | 1046 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { |
1048 base::DiscardableMemoryType type = | 1047 base::DiscardableMemoryType type = |
1049 base::DiscardableMemory::GetPreferredType(); | 1048 base::DiscardableMemory::GetPreferredType(); |
1050 if (type == base::DISCARDABLE_MEMORY_TYPE_EMULATED) | 1049 if (type == base::DISCARDABLE_MEMORY_TYPE_EMULATED) |
1051 return NULL; | 1050 return NULL; |
1052 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); | 1051 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); |
1053 } | 1052 } |
1054 | 1053 |
1055 size_t BlinkPlatformImpl::maxDecodedImageBytes() { | 1054 size_t BlinkPlatformImpl::maxDecodedImageBytes() { |
1056 #if defined(OS_ANDROID) | 1055 #if defined(OS_ANDROID) |
1057 if (base::android::SysUtils::IsLowEndDevice()) { | 1056 if (base::SysInfo::IsLowEndDevice()) { |
1058 // Limit image decoded size to 3M pixels on low end devices. | 1057 // Limit image decoded size to 3M pixels on low end devices. |
1059 // 4 is maximum number of bytes per pixel. | 1058 // 4 is maximum number of bytes per pixel. |
1060 return 3 * 1024 * 1024 * 4; | 1059 return 3 * 1024 * 1024 * 4; |
1061 } | 1060 } |
1062 // For other devices, limit decoded image size based on the amount of physical | 1061 // For other devices, limit decoded image size based on the amount of physical |
1063 // memory. | 1062 // memory. |
1064 // In some cases all physical memory is not accessible by Chromium, as it can | 1063 // In some cases all physical memory is not accessible by Chromium, as it can |
1065 // be reserved for direct use by certain hardware. Thus, we set the limit so | 1064 // be reserved for direct use by certain hardware. Thus, we set the limit so |
1066 // that 1.6GB of reported physical memory on a 2GB device is enough to set the | 1065 // that 1.6GB of reported physical memory on a 2GB device is enough to set the |
1067 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively | 1066 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively |
(...skipping 28 matching lines...) Expand all Loading... |
1096 } | 1095 } |
1097 | 1096 |
1098 // static | 1097 // static |
1099 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1098 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
1100 WebThreadImplForMessageLoop* impl = | 1099 WebThreadImplForMessageLoop* impl = |
1101 static_cast<WebThreadImplForMessageLoop*>(thread); | 1100 static_cast<WebThreadImplForMessageLoop*>(thread); |
1102 delete impl; | 1101 delete impl; |
1103 } | 1102 } |
1104 | 1103 |
1105 } // namespace content | 1104 } // namespace content |
OLD | NEW |