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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 220993003: Adjust maximum decoded image size on Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | 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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698