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/webkitplatformsupport_impl.h" | 5 #include "webkit/glue/webkitplatformsupport_impl.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
8 #include <malloc.h> | 8 #include <malloc.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 } | 674 } |
675 | 675 |
676 size_t WebKitPlatformSupportImpl::memoryUsageMB() { | 676 size_t WebKitPlatformSupportImpl::memoryUsageMB() { |
677 return getMemoryUsageMB(false); | 677 return getMemoryUsageMB(false); |
678 } | 678 } |
679 | 679 |
680 size_t WebKitPlatformSupportImpl::actualMemoryUsageMB() { | 680 size_t WebKitPlatformSupportImpl::actualMemoryUsageMB() { |
681 return getMemoryUsageMB(true); | 681 return getMemoryUsageMB(true); |
682 } | 682 } |
683 | 683 |
684 bool WebKitPlatformSupportImpl::getProcessMemorySize(size_t* private_bytes, | |
685 size_t* shared_bytes) { | |
686 using base::ProcessMetrics; | |
687 #if defined(OS_MACOSX) | |
688 static ProcessMetrics* process_metrics = | |
tony
2012/05/29 18:11:18
CR_DEFINE_STATIC_LOCAL.
It would be nice if we co
yurys
2012/05/30 08:06:27
CR_DEFINE_STATIC_LOCAL cannot be used here as it c
| |
689 // The default port provider is sufficient to get data for the current | |
690 // process. | |
691 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(), | |
692 NULL); | |
693 #else | |
694 static ProcessMetrics* process_metrics = | |
tony
2012/05/29 18:11:18
CR_DEFINE_STATIC_LOCAL
yurys
2012/05/30 08:06:27
See my previous comment.
| |
695 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle()); | |
696 #endif | |
697 DCHECK(process_metrics); | |
698 return process_metrics->GetMemoryBytes(private_bytes, shared_bytes); | |
699 } | |
700 | |
684 void WebKitPlatformSupportImpl::SuspendSharedTimer() { | 701 void WebKitPlatformSupportImpl::SuspendSharedTimer() { |
685 ++shared_timer_suspended_; | 702 ++shared_timer_suspended_; |
686 } | 703 } |
687 | 704 |
688 void WebKitPlatformSupportImpl::ResumeSharedTimer() { | 705 void WebKitPlatformSupportImpl::ResumeSharedTimer() { |
689 // The shared timer may have fired or been adjusted while we were suspended. | 706 // The shared timer may have fired or been adjusted while we were suspended. |
690 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { | 707 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { |
691 setSharedTimerFireInterval( | 708 setSharedTimerFireInterval( |
692 shared_timer_fire_time_ - monotonicallyIncreasingTime()); | 709 shared_timer_fire_time_ - monotonicallyIncreasingTime()); |
693 } | 710 } |
(...skipping 12 matching lines...) Expand all Loading... | |
706 worker_task_runner->OnWorkerRunLoopStarted(runLoop); | 723 worker_task_runner->OnWorkerRunLoopStarted(runLoop); |
707 } | 724 } |
708 | 725 |
709 void WebKitPlatformSupportImpl::didStopWorkerRunLoop( | 726 void WebKitPlatformSupportImpl::didStopWorkerRunLoop( |
710 const WebKit::WebWorkerRunLoop& runLoop) { | 727 const WebKit::WebWorkerRunLoop& runLoop) { |
711 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); | 728 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); |
712 worker_task_runner->OnWorkerRunLoopStopped(runLoop); | 729 worker_task_runner->OnWorkerRunLoopStopped(runLoop); |
713 } | 730 } |
714 | 731 |
715 } // namespace webkit_glue | 732 } // namespace webkit_glue |
OLD | NEW |