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

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

Issue 258663002: Expose a low-end device mode override flags for non-android OSs as well (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments. Created 6 years, 6 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
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "net/base/data_url.h" 42 #include "net/base/data_url.h"
43 #include "net/base/mime_util.h" 43 #include "net/base/mime_util.h"
44 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
45 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" 45 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h"
46 #include "third_party/WebKit/public/platform/WebData.h" 46 #include "third_party/WebKit/public/platform/WebData.h"
47 #include "third_party/WebKit/public/platform/WebString.h" 47 #include "third_party/WebKit/public/platform/WebString.h"
48 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" 48 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
49 #include "ui/base/layout.h" 49 #include "ui/base/layout.h"
50 50
51 #if defined(OS_ANDROID) 51 #if defined(OS_ANDROID)
52 #include "base/android/sys_utils.h"
53 #include "content/child/fling_animator_impl_android.h" 52 #include "content/child/fling_animator_impl_android.h"
54 #endif 53 #endif
55 54
56 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) 55 #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
57 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 56 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
58 #endif 57 #endif
59 58
60 using blink::WebData; 59 using blink::WebData;
61 using blink::WebFallbackThemeEngine; 60 using blink::WebFallbackThemeEngine;
62 using blink::WebLocalizedString; 61 using blink::WebLocalizedString;
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { 1051 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) {
1053 base::DiscardableMemoryType type = 1052 base::DiscardableMemoryType type =
1054 base::DiscardableMemory::GetPreferredType(); 1053 base::DiscardableMemory::GetPreferredType();
1055 if (type == base::DISCARDABLE_MEMORY_TYPE_EMULATED) 1054 if (type == base::DISCARDABLE_MEMORY_TYPE_EMULATED)
1056 return NULL; 1055 return NULL;
1057 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); 1056 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release();
1058 } 1057 }
1059 1058
1060 size_t BlinkPlatformImpl::maxDecodedImageBytes() { 1059 size_t BlinkPlatformImpl::maxDecodedImageBytes() {
1061 #if defined(OS_ANDROID) 1060 #if defined(OS_ANDROID)
1062 if (base::android::SysUtils::IsLowEndDevice()) { 1061 if (base::SysInfo::IsLowEndDevice()) {
1063 // Limit image decoded size to 3M pixels on low end devices. 1062 // Limit image decoded size to 3M pixels on low end devices.
1064 // 4 is maximum number of bytes per pixel. 1063 // 4 is maximum number of bytes per pixel.
1065 return 3 * 1024 * 1024 * 4; 1064 return 3 * 1024 * 1024 * 4;
1066 } 1065 }
1067 // For other devices, limit decoded image size based on the amount of physical 1066 // For other devices, limit decoded image size based on the amount of physical
1068 // memory. 1067 // memory.
1069 // In some cases all physical memory is not accessible by Chromium, as it can 1068 // In some cases all physical memory is not accessible by Chromium, as it can
1070 // be reserved for direct use by certain hardware. Thus, we set the limit so 1069 // be reserved for direct use by certain hardware. Thus, we set the limit so
1071 // that 1.6GB of reported physical memory on a 2GB device is enough to set the 1070 // that 1.6GB of reported physical memory on a 2GB device is enough to set the
1072 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively 1071 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively
(...skipping 28 matching lines...) Expand all
1101 } 1100 }
1102 1101
1103 // static 1102 // static
1104 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1103 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1105 WebThreadImplForMessageLoop* impl = 1104 WebThreadImplForMessageLoop* impl =
1106 static_cast<WebThreadImplForMessageLoop*>(thread); 1105 static_cast<WebThreadImplForMessageLoop*>(thread);
1107 delete impl; 1106 delete impl;
1108 } 1107 }
1109 1108
1110 } // namespace content 1109 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | content/renderer/gpu/render_widget_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698