summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build_config.h5
-rw-r--r--chrome/DEPS3
-rw-r--r--chrome/browser/browser_about_handler.cc21
-rw-r--r--chrome/chrome.gyp5
4 files changed, 32 insertions, 2 deletions
diff --git a/build/build_config.h b/build/build_config.h
index 906f492..f6e4f3b 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -54,6 +54,11 @@
#define USE_X11 1
#endif
+// Use tcmalloc
+#if defined(OS_WIN) && ! defined(NO_TCMALLOC)
+#define USE_TCMALLOC 1
+#endif
+
// Compiler detection.
#if defined(__GNUC__)
#define COMPILER_GCC 1
diff --git a/chrome/DEPS b/chrome/DEPS
index 2519453..c1fb4b8 100644
--- a/chrome/DEPS
+++ b/chrome/DEPS
@@ -24,6 +24,9 @@ include_rules = [
# Allow inclusion of Mozilla interface headers.
"+third_party/mozilla",
+ # Allow inclusion of tcmalloc header.
+ "+third_party/tcmalloc",
+
# Allow usage of Google Toolbox for Mac.
"+third_party/GTM",
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 9331606..9f17f77 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -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 kHistogramsPath[] = "histograms";
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 @@ std::string AboutDns() {
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 @@ void AboutSource::StartDataRequest(const std::string& path_raw,
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);
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 79fad25..10d058a2 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2404,11 +2404,12 @@
'third_party/wtl/include',
],
'dependencies': [
+ '../gears/gears.gyp:gears',
'../google_update/google_update.gyp:google_update',
- 'installer/installer.gyp:installer_util',
'../third_party/cld/cld.gyp:cld',
+ '../third_party/tcmalloc/tcmalloc.gyp:tcmalloc',
'../views/views.gyp:views',
- '../gears/gears.gyp:gears',
+ 'installer/installer.gyp:installer_util',
],
'export_dependent_settings': [
'../views/views.gyp:views',