Index: chrome/browser/browser_about_handler.cc |
=================================================================== |
--- chrome/browser/browser_about_handler.cc (revision 26802) |
+++ chrome/browser/browser_about_handler.cc (working copy) |
@@ -52,6 +52,10 @@ |
#include "chrome/browser/chromeos/chromeos_version_loader.h" |
#endif |
+#if defined(USE_TCMALLOC) |
+#include "third_party/tcmalloc/google/malloc_extension.h" |
+#endif |
+ |
#ifdef CHROME_PERSONALIZATION |
#include "chrome/browser/sync/auth_error_state.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
@@ -70,6 +74,7 @@ |
const char kObjectsPath[] = "objects"; |
const char kMemoryRedirectPath[] = "memory-redirect"; |
const char kMemoryPath[] = "memory"; |
+const char kTcmallocPath[] = "tcmalloc"; |
const char kPluginsPath[] = "plugins"; |
const char kStatsPath[] = "stats"; |
const char kVersionPath[] = "version"; |
@@ -181,6 +186,18 @@ |
return data; |
} |
+#if defined(USE_TCMALLOC) |
+std::string AboutTcmalloc(const std::string& query) { |
+ std::string data; |
+ char buffer[1024*32]; |
+ MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); |
+ data.append("<html><head><title>About tcmalloc</title></head><body><pre>\n"); |
+ data.append(buffer); |
+ data.append("</pre></body></html>\n"); |
+ return data; |
+} |
+#endif |
+ |
std::string AboutHistograms(const std::string& query) { |
TimeDelta wait_time = TimeDelta::FromMilliseconds(10000); |
@@ -550,6 +567,10 @@ |
response = AboutPlugins(); |
} else if (path == kStatsPath) { |
response = AboutStats(); |
+#if defined(USE_TCMALLOC) |
+ } else if (path == kTcmallocPath) { |
+ response = AboutTcmalloc(info); |
+#endif |
} else if (path == kVersionPath || path.empty()) { |
#if defined(OS_CHROMEOS) |
new ChromeOSAboutVersionHandler(this, request_id); |