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

Unified 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: Addressed Tony's comments Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webkitplatformsupport_impl.cc
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index 6003cce1c4ffea8838b2c85130904d4213f15281..062f91651ed917552eab8e51e0c14cb19e994de7 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -669,6 +669,22 @@ WebKit::WebString WebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
return WebKit::WebString("");
}
+static base::ProcessMetrics* CurrentProcessMetrics() {
+ using base::ProcessMetrics;
+#if defined(OS_MACOSX)
+ static ProcessMetrics* process_metrics =
+ // The default port provider is sufficient to get data for the current
+ // process.
+ ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(),
+ NULL);
+#else
+ static ProcessMetrics* process_metrics =
+ ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle());
+#endif
+ DCHECK(process_metrics);
+ return process_metrics;
+}
+
#if defined(OS_LINUX) || defined(OS_ANDROID)
static size_t memoryUsageMB() {
struct mallinfo minfo = mallinfo();
@@ -684,24 +700,9 @@ static size_t memoryUsageMB() {
v8::V8::GetHeapStatistics(&stat);
return mem_usage + (static_cast<uint64_t>(stat.total_heap_size()) >> 20);
}
-#elif defined(OS_MACOSX)
-static size_t memoryUsageMB() {
- using base::ProcessMetrics;
- static ProcessMetrics* process_metrics =
- // The default port provider is sufficient to get data for the current
- // process.
- ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(),
- NULL);
- DCHECK(process_metrics);
- return process_metrics->GetWorkingSetSize() >> 20;
ulan 2012/09/21 13:30:08 Just noticed that this is missing in the current T
yurys 2012/09/21 13:52:12 Looks like GetWorkingSetSize was deleted by mistak
-}
#else
static size_t memoryUsageMB() {
- using base::ProcessMetrics;
- static ProcessMetrics* process_metrics =
- ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle());
- DCHECK(process_metrics);
- return process_metrics->GetPagefileUsage() >> 20;
+ return CurrentProcessMetrics()->GetPagefileUsage() >> 20;
}
#endif
@@ -748,6 +749,12 @@ size_t WebKitPlatformSupportImpl::highUsageDeltaMB() {
}
#endif
+bool WebKitPlatformSupportImpl::processMemorySizesInBytes(
+ size_t* private_bytes,
+ size_t* shared_bytes) {
+ return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes);
+}
+
void WebKitPlatformSupportImpl::SuspendSharedTimer() {
++shared_timer_suspended_;
}
« 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