OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <mlang.h> | 8 #include <mlang.h> |
9 #include <objidl.h> | 9 #include <objidl.h> |
10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 struct mallinfo minfo = mallinfo(); | 344 struct mallinfo minfo = mallinfo(); |
345 uint64_t mem_usage = | 345 uint64_t mem_usage = |
346 #if defined(USE_TCMALLOC) | 346 #if defined(USE_TCMALLOC) |
347 minfo.uordblks | 347 minfo.uordblks |
348 #else | 348 #else |
349 (minfo.hblkhd + minfo.arena) | 349 (minfo.hblkhd + minfo.arena) |
350 #endif | 350 #endif |
351 >> 10; | 351 >> 10; |
352 | 352 |
353 v8::HeapStatistics stat; | 353 v8::HeapStatistics stat; |
354 v8::V8::GetHeapStatistics(&stat); | 354 v8::Isolate::GetCurrent()->GetHeapStatistics(&stat); |
355 return mem_usage + (static_cast<uint64_t>(stat.total_heap_size()) >> 10); | 355 return mem_usage + (static_cast<uint64_t>(stat.total_heap_size()) >> 10); |
356 } | 356 } |
357 #elif defined(OS_MACOSX) | 357 #elif defined(OS_MACOSX) |
358 size_t MemoryUsageKB() { | 358 size_t MemoryUsageKB() { |
359 scoped_ptr<base::ProcessMetrics> process_metrics( | 359 scoped_ptr<base::ProcessMetrics> process_metrics( |
360 // The default port provider is sufficient to get data for the current | 360 // The default port provider is sufficient to get data for the current |
361 // process. | 361 // process. |
362 base::ProcessMetrics::CreateProcessMetrics( | 362 base::ProcessMetrics::CreateProcessMetrics( |
363 base::GetCurrentProcessHandle(), NULL)); | 363 base::GetCurrentProcessHandle(), NULL)); |
364 return process_metrics->GetWorkingSetSize() >> 10; | 364 return process_metrics->GetWorkingSetSize() >> 10; |
365 } | 365 } |
366 #else | 366 #else |
367 size_t MemoryUsageKB() { | 367 size_t MemoryUsageKB() { |
368 scoped_ptr<base::ProcessMetrics> process_metrics( | 368 scoped_ptr<base::ProcessMetrics> process_metrics( |
369 base::ProcessMetrics::CreateProcessMetrics( | 369 base::ProcessMetrics::CreateProcessMetrics( |
370 base::GetCurrentProcessHandle())); | 370 base::GetCurrentProcessHandle())); |
371 return process_metrics->GetPagefileUsage() >> 10; | 371 return process_metrics->GetPagefileUsage() >> 10; |
372 } | 372 } |
373 #endif | 373 #endif |
374 | 374 |
375 double ZoomFactorToZoomLevel(double factor) { | 375 double ZoomFactorToZoomLevel(double factor) { |
376 return WebView::zoomFactorToZoomLevel(factor); | 376 return WebView::zoomFactorToZoomLevel(factor); |
377 } | 377 } |
378 | 378 |
379 } // namespace webkit_glue | 379 } // namespace webkit_glue |
OLD | NEW |