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

Unified Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 11829032: Add a histogram for renderer memory usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar build fixes Created 7 years, 11 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/webkit_glue.cc ('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 91069d3938148a53b5f22e463058e5562b71d15f..0def89395c5834fe9c66e0a9a316c416f139e3da 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -4,10 +4,6 @@
#include "webkit/glue/webkitplatformsupport_impl.h"
-#if defined(OS_LINUX)
-#include <malloc.h>
-#endif
-
#include <math.h>
#include <vector>
@@ -46,6 +42,7 @@
#include "webkit/base/file_path_string_conversions.h"
#include "webkit/compositor_bindings/web_compositor_support_impl.h"
#include "webkit/glue/touch_fling_gesture_curve.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/websocketstreamhandle_impl.h"
#include "webkit/glue/webthread_impl.h"
#include "webkit/glue/weburlloader_impl.h"
@@ -59,10 +56,6 @@
#include "webkit/glue/fling_animator_impl_android.h"
#endif
-#if defined(OS_LINUX)
-#include "v8/include/v8.h"
-#endif
-
using WebKit::WebAudioBus;
using WebKit::WebCookie;
using WebKit::WebData;
@@ -834,31 +827,6 @@ static scoped_ptr<base::ProcessMetrics> CurrentProcessMetrics() {
#endif
}
-#if defined(OS_LINUX) || defined(OS_ANDROID)
-static size_t memoryUsageMB() {
- struct mallinfo minfo = mallinfo();
- uint64_t mem_usage =
-#if defined(USE_TCMALLOC)
- minfo.uordblks
-#else
- (minfo.hblkhd + minfo.arena)
-#endif
- >> 20;
-
- v8::HeapStatistics stat;
- v8::V8::GetHeapStatistics(&stat);
- return mem_usage + (static_cast<uint64_t>(stat.total_heap_size()) >> 20);
-}
-#elif defined(OS_MACOSX)
-static size_t memoryUsageMB() {
- return CurrentProcessMetrics()->GetWorkingSetSize() >> 20;
-}
-#else
-static size_t memoryUsageMB() {
- return CurrentProcessMetrics()->GetPagefileUsage() >> 20;
-}
-#endif
-
static size_t getMemoryUsageMB(bool bypass_cache) {
size_t current_mem_usage = 0;
MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance();
@@ -866,7 +834,7 @@ static size_t getMemoryUsageMB(bool bypass_cache) {
mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage))
return current_mem_usage;
- current_mem_usage = memoryUsageMB();
+ current_mem_usage = MemoryUsageKB() >> 10;
mem_usage_cache_singleton->SetMemoryValue(current_mem_usage);
return current_mem_usage;
}
« no previous file with comments | « webkit/glue/webkit_glue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698