| 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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 size_t BlinkPlatformImpl::maxDecodedImageBytes() { | 1001 size_t BlinkPlatformImpl::maxDecodedImageBytes() { |
| 1002 #if defined(OS_ANDROID) | 1002 #if defined(OS_ANDROID) |
| 1003 if (base::android::SysUtils::IsLowEndDevice()) { | 1003 if (base::android::SysUtils::IsLowEndDevice()) { |
| 1004 // Limit image decoded size to 3M pixels on low end devices. | 1004 // Limit image decoded size to 3M pixels on low end devices. |
| 1005 // 4 is maximum number of bytes per pixel. | 1005 // 4 is maximum number of bytes per pixel. |
| 1006 return 3 * 1024 * 1024 * 4; | 1006 return 3 * 1024 * 1024 * 4; |
| 1007 } | 1007 } |
| 1008 // For other devices, limit decoded image size based on the amount of physical | 1008 // For other devices, limit decoded image size based on the amount of physical |
| 1009 // memory. For a device with 2GB physical memory the limit is 16M pixels. | 1009 // memory. |
| 1010 return base::SysInfo::AmountOfPhysicalMemory() / 32; | 1010 // In some cases all physical memory is not accessible by Chromium, as it can |
| 1011 // be reserved for direct use by certain hardware. Thus, we set the limit so |
| 1012 // that 1.6GB of reported physical memory on a 2GB device is enough to set the |
| 1013 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively |
| 1014 // common texture size. |
| 1015 return base::SysInfo::AmountOfPhysicalMemory() / 25; |
| 1011 #else | 1016 #else |
| 1012 return noDecodedImageByteLimit; | 1017 return noDecodedImageByteLimit; |
| 1013 #endif | 1018 #endif |
| 1014 } | 1019 } |
| 1015 | 1020 |
| 1016 void BlinkPlatformImpl::SetFlingCurveParameters( | 1021 void BlinkPlatformImpl::SetFlingCurveParameters( |
| 1017 const std::vector<float>& new_touchpad, | 1022 const std::vector<float>& new_touchpad, |
| 1018 const std::vector<float>& new_touchscreen) { | 1023 const std::vector<float>& new_touchscreen) { |
| 1019 fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen); | 1024 fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen); |
| 1020 } | 1025 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1037 } | 1042 } |
| 1038 | 1043 |
| 1039 // static | 1044 // static |
| 1040 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1045 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 1041 WebThreadImplForMessageLoop* impl = | 1046 WebThreadImplForMessageLoop* impl = |
| 1042 static_cast<WebThreadImplForMessageLoop*>(thread); | 1047 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 1043 delete impl; | 1048 delete impl; |
| 1044 } | 1049 } |
| 1045 | 1050 |
| 1046 } // namespace content | 1051 } // namespace content |
| OLD | NEW |