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

Side by Side Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 9669039: Provide access to process private and shared memory size from WebKit code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Return both private and shared memory size in one call Created 8 years, 9 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
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 {
pfeldman 2012/03/11 15:25:26 { on wrong line.
yurys 2012/03/11 15:25:58 Done.
687 using base::ProcessMetrics;
688 #if defined(OS_MACOSX)
689 static ProcessMetrics* process_metrics =
690 // The default port provider is sufficient to get data for the current
691 // process.
692 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(),
693 NULL);
694 #else
695 static ProcessMetrics* process_metrics =
696 ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle());
697 #endif
698 DCHECK(process_metrics);
699 return process_metrics->GetMemoryBytes(private_bytes, shared_bytes);
700 }
701
684 void WebKitPlatformSupportImpl::SuspendSharedTimer() { 702 void WebKitPlatformSupportImpl::SuspendSharedTimer() {
685 ++shared_timer_suspended_; 703 ++shared_timer_suspended_;
686 } 704 }
687 705
688 void WebKitPlatformSupportImpl::ResumeSharedTimer() { 706 void WebKitPlatformSupportImpl::ResumeSharedTimer() {
689 // The shared timer may have fired or been adjusted while we were suspended. 707 // The shared timer may have fired or been adjusted while we were suspended.
690 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { 708 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) {
691 setSharedTimerFireInterval( 709 setSharedTimerFireInterval(
692 shared_timer_fire_time_ - monotonicallyIncreasingTime()); 710 shared_timer_fire_time_ - monotonicallyIncreasingTime());
693 } 711 }
(...skipping 12 matching lines...) Expand all
706 worker_task_runner->OnWorkerRunLoopStarted(runLoop); 724 worker_task_runner->OnWorkerRunLoopStarted(runLoop);
707 } 725 }
708 726
709 void WebKitPlatformSupportImpl::didStopWorkerRunLoop( 727 void WebKitPlatformSupportImpl::didStopWorkerRunLoop(
710 const WebKit::WebWorkerRunLoop& runLoop) { 728 const WebKit::WebWorkerRunLoop& runLoop) {
711 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); 729 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance();
712 worker_task_runner->OnWorkerRunLoopStopped(runLoop); 730 worker_task_runner->OnWorkerRunLoopStopped(runLoop);
713 } 731 }
714 732
715 } // namespace webkit_glue 733 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698