Index: webkit/glue/webkitplatformsupport_impl.cc |
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc |
index fe80547877be6ca318df6f55d462bcbcbba6903c..3ff674f8635d684b31f05f9d68f79a513cff70f9 100644 |
--- a/webkit/glue/webkitplatformsupport_impl.cc |
+++ b/webkit/glue/webkitplatformsupport_impl.cc |
@@ -48,6 +48,10 @@ |
#include "webkit/plugins/npapi/plugin_instance.h" |
#include "webkit/plugins/webplugininfo.h" |
+#if defined(USE_TCMALLOC) |
+#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
+#endif |
+ |
#if defined(OS_LINUX) |
#include "v8/include/v8.h" |
#endif |
@@ -758,6 +762,37 @@ bool WebKitPlatformSupportImpl::processMemorySizesInBytes( |
return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); |
} |
+bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* psize) { |
darin (slow to review)
2012/08/07 22:06:14
nit: avoid Hungarian notation... psize -> size
alexeif
2012/08/08 17:18:36
Done.
|
+#if defined(USE_TCMALLOC) |
jamesr
2012/08/07 22:15:59
having defined(USE_TCMALLOC) set does not mean tha
alexeif
2012/08/08 17:18:36
done it in a separate CL https://chromiumcoderevie
|
+ MallocExtension* malloc_ext = MallocExtension::instance(); |
darin (slow to review)
2012/08/07 22:06:14
nit: indentation
alexeif
2012/08/08 17:18:36
Done.
|
+ DCHECK(malloc_ext); |
+ std::vector<MallocExtension::FreeListInfo> free_list_info; |
+ malloc_ext->GetFreeListSizes(&free_list_info); |
+ size_t size = 0; |
+ std::vector<MallocExtension::FreeListInfo>::iterator it; |
+ for (it = free_list_info.begin(); it != free_list_info.end(); ++it) { |
+#ifdef NDEBUG |
+ if (it->total_bytes_free == 0) |
+ continue; |
+#endif |
+ if (strcmp(it->type, "tcmalloc.central") == 0 || |
+ strcmp(it->type, "tcmalloc.transfer") == 0 || |
+ strcmp(it->type, "tcmalloc.thread") == 0 || |
+ strcmp(it->type, "tcmalloc.large") == 0 || |
+ strcmp(it->type, "tcmalloc.page") == 0) { |
+ size += it->total_bytes_free; |
+ continue; |
+ } |
+ DCHECK(strcmp(it->type, "tcmalloc.large_unmapped") == 0 || |
+ strcmp(it->type, "tcmalloc.page_unmapped") == 0); |
+ } |
+ *psize = size; |
+ return true; |
+#else |
+ return false; |
+#endif |
+} |
+ |
void WebKitPlatformSupportImpl::SuspendSharedTimer() { |
++shared_timer_suspended_; |
} |