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

Unified Diff: chrome/browser/browser_about_handler.cc

Issue 216033: Add a simple about:tcmalloc page that just displays its canned stats.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add dependency in chrome.gyp Created 11 years, 3 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 | « chrome/DEPS ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/DEPS ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698