| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "content/child/content_child_helpers.h" | 43 #include "content/child/content_child_helpers.h" |
| 44 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 44 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
| 45 #include "content/child/navigator_connect/service_port_provider.h" | 45 #include "content/child/navigator_connect/service_port_provider.h" |
| 46 #include "content/child/notifications/notification_dispatcher.h" | 46 #include "content/child/notifications/notification_dispatcher.h" |
| 47 #include "content/child/notifications/notification_manager.h" | 47 #include "content/child/notifications/notification_manager.h" |
| 48 #include "content/child/permissions/permission_dispatcher.h" | 48 #include "content/child/permissions/permission_dispatcher.h" |
| 49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
| 50 #include "content/child/push_messaging/push_dispatcher.h" | 50 #include "content/child/push_messaging/push_dispatcher.h" |
| 51 #include "content/child/push_messaging/push_provider.h" | 51 #include "content/child/push_messaging/push_provider.h" |
| 52 #include "content/child/thread_safe_sender.h" | 52 #include "content/child/thread_safe_sender.h" |
| 53 #include "content/child/web_discardable_memory_impl.h" | |
| 54 #include "content/child/web_url_loader_impl.h" | 53 #include "content/child/web_url_loader_impl.h" |
| 55 #include "content/child/web_url_request_util.h" | 54 #include "content/child/web_url_request_util.h" |
| 56 #include "content/child/websocket_bridge.h" | 55 #include "content/child/websocket_bridge.h" |
| 57 #include "content/child/worker_thread_registry.h" | 56 #include "content/child/worker_thread_registry.h" |
| 58 #include "content/public/common/content_client.h" | 57 #include "content/public/common/content_client.h" |
| 59 #include "net/base/data_url.h" | 58 #include "net/base/data_url.h" |
| 60 #include "net/base/ip_address_number.h" | 59 #include "net/base/ip_address_number.h" |
| 61 #include "net/base/net_errors.h" | 60 #include "net/base/net_errors.h" |
| 62 #include "net/base/port_util.h" | 61 #include "net/base/port_util.h" |
| 63 #include "third_party/WebKit/public/platform/WebData.h" | 62 #include "third_party/WebKit/public/platform/WebData.h" |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 } | 968 } |
| 970 | 969 |
| 971 size_t BlinkPlatformImpl::actualMemoryUsageMB() { | 970 size_t BlinkPlatformImpl::actualMemoryUsageMB() { |
| 972 return GetMemoryUsageKB() >> 10; | 971 return GetMemoryUsageKB() >> 10; |
| 973 } | 972 } |
| 974 | 973 |
| 975 size_t BlinkPlatformImpl::numberOfProcessors() { | 974 size_t BlinkPlatformImpl::numberOfProcessors() { |
| 976 return static_cast<size_t>(base::SysInfo::NumberOfProcessors()); | 975 return static_cast<size_t>(base::SysInfo::NumberOfProcessors()); |
| 977 } | 976 } |
| 978 | 977 |
| 979 blink::WebDiscardableMemory* | |
| 980 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { | |
| 981 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); | |
| 982 } | |
| 983 | |
| 984 size_t BlinkPlatformImpl::maxDecodedImageBytes() { | 978 size_t BlinkPlatformImpl::maxDecodedImageBytes() { |
| 985 #if defined(OS_ANDROID) | 979 #if defined(OS_ANDROID) |
| 986 if (base::SysInfo::IsLowEndDevice()) { | 980 if (base::SysInfo::IsLowEndDevice()) { |
| 987 // Limit image decoded size to 3M pixels on low end devices. | 981 // Limit image decoded size to 3M pixels on low end devices. |
| 988 // 4 is maximum number of bytes per pixel. | 982 // 4 is maximum number of bytes per pixel. |
| 989 return 3 * 1024 * 1024 * 4; | 983 return 3 * 1024 * 1024 * 4; |
| 990 } | 984 } |
| 991 // For other devices, limit decoded image size based on the amount of physical | 985 // For other devices, limit decoded image size based on the amount of physical |
| 992 // memory. | 986 // memory. |
| 993 // In some cases all physical memory is not accessible by Chromium, as it can | 987 // In some cases all physical memory is not accessible by Chromium, as it can |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1020 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1027 static_cast<ui::DomKey>(dom_key))); | 1021 static_cast<ui::DomKey>(dom_key))); |
| 1028 } | 1022 } |
| 1029 | 1023 |
| 1030 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1024 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1031 return static_cast<int>( | 1025 return static_cast<int>( |
| 1032 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1026 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1033 } | 1027 } |
| 1034 | 1028 |
| 1035 } // namespace content | 1029 } // namespace content |
| OLD | NEW |