| 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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 return false; | 1208 return false; |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString( | 1211 blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString( |
| 1212 unsigned key_size_index, | 1212 unsigned key_size_index, |
| 1213 const blink::WebString& challenge, | 1213 const blink::WebString& challenge, |
| 1214 const blink::WebURL& url) { | 1214 const blink::WebURL& url) { |
| 1215 return blink::WebString(""); | 1215 return blink::WebString(""); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 static scoped_ptr<base::ProcessMetrics> CurrentProcessMetrics() { | |
| 1219 using base::ProcessMetrics; | |
| 1220 #if defined(OS_MACOSX) | |
| 1221 return scoped_ptr<ProcessMetrics>( | |
| 1222 // The default port provider is sufficient to get data for the current | |
| 1223 // process. | |
| 1224 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(), | |
| 1225 NULL)); | |
| 1226 #else | |
| 1227 return scoped_ptr<ProcessMetrics>( | |
| 1228 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle())); | |
| 1229 #endif | |
| 1230 } | |
| 1231 | |
| 1232 static size_t getMemoryUsageMB(bool bypass_cache) { | 1218 static size_t getMemoryUsageMB(bool bypass_cache) { |
| 1233 size_t current_mem_usage = 0; | 1219 size_t current_mem_usage = 0; |
| 1234 MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance(); | 1220 MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance(); |
| 1235 if (!bypass_cache && | 1221 if (!bypass_cache && |
| 1236 mem_usage_cache_singleton->IsCachedValueValid(¤t_mem_usage)) | 1222 mem_usage_cache_singleton->IsCachedValueValid(¤t_mem_usage)) |
| 1237 return current_mem_usage; | 1223 return current_mem_usage; |
| 1238 | 1224 |
| 1239 current_mem_usage = GetMemoryUsageKB() >> 10; | 1225 current_mem_usage = GetMemoryUsageKB() >> 10; |
| 1240 mem_usage_cache_singleton->SetMemoryValue(current_mem_usage); | 1226 mem_usage_cache_singleton->SetMemoryValue(current_mem_usage); |
| 1241 return current_mem_usage; | 1227 return current_mem_usage; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1261 return base::SysInfo::IsLowEndDevice(); | 1247 return base::SysInfo::IsLowEndDevice(); |
| 1262 } | 1248 } |
| 1263 | 1249 |
| 1264 size_t BlinkPlatformImpl::numberOfProcessors() { | 1250 size_t BlinkPlatformImpl::numberOfProcessors() { |
| 1265 return static_cast<size_t>(base::SysInfo::NumberOfProcessors()); | 1251 return static_cast<size_t>(base::SysInfo::NumberOfProcessors()); |
| 1266 } | 1252 } |
| 1267 | 1253 |
| 1268 bool BlinkPlatformImpl::processMemorySizesInBytes( | 1254 bool BlinkPlatformImpl::processMemorySizesInBytes( |
| 1269 size_t* private_bytes, | 1255 size_t* private_bytes, |
| 1270 size_t* shared_bytes) { | 1256 size_t* shared_bytes) { |
| 1271 return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); | 1257 scoped_ptr<base::ProcessMetrics> current_process_metrics( |
| 1258 base::ProcessMetrics::CreateCurrentProcessMetrics()); |
| 1259 return current_process_metrics->GetMemoryBytes(private_bytes, shared_bytes); |
| 1272 } | 1260 } |
| 1273 | 1261 |
| 1274 bool BlinkPlatformImpl::memoryAllocatorWasteInBytes(size_t* size) { | 1262 bool BlinkPlatformImpl::memoryAllocatorWasteInBytes(size_t* size) { |
| 1275 return base::allocator::GetAllocatorWasteSize(size); | 1263 return base::allocator::GetAllocatorWasteSize(size); |
| 1276 } | 1264 } |
| 1277 | 1265 |
| 1278 blink::WebDiscardableMemory* | 1266 blink::WebDiscardableMemory* |
| 1279 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { | 1267 BlinkPlatformImpl::allocateAndLockDiscardableMemory(size_t bytes) { |
| 1280 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); | 1268 return content::WebDiscardableMemoryImpl::CreateLockedMemory(bytes).release(); |
| 1281 } | 1269 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1313 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1326 static_cast<ui::DomKey>(dom_key))); | 1314 static_cast<ui::DomKey>(dom_key))); |
| 1327 } | 1315 } |
| 1328 | 1316 |
| 1329 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1317 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1330 return static_cast<int>( | 1318 return static_cast<int>( |
| 1331 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1319 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1332 } | 1320 } |
| 1333 | 1321 |
| 1334 } // namespace content | 1322 } // namespace content |
| OLD | NEW |