summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_about_handler.h
diff options
context:
space:
mode:
authorsgk@chromium.org <sgk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 06:56:57 +0000
committersgk@chromium.org <sgk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 06:56:57 +0000
commitd4104109bee8967a047254ec82afa6ee1f70ba86 (patch)
tree853ff2e3e931c3c3d239268b5f640bd0f9150625 /chrome/browser/browser_about_handler.h
parent9b2a18d8d24244eb1834ce54ac1e82a6dbfc13bc (diff)
downloadchromium_src-d4104109bee8967a047254ec82afa6ee1f70ba86.zip
chromium_src-d4104109bee8967a047254ec82afa6ee1f70ba86.tar.gz
chromium_src-d4104109bee8967a047254ec82afa6ee1f70ba86.tar.bz2
Display tcmalloc debug output from renderer processes in about:tcmalloc.
BUG=none TEST=none Review URL: http://codereview.chromium.org/255080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_about_handler.h')
-rw-r--r--chrome/browser/browser_about_handler.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/chrome/browser/browser_about_handler.h b/chrome/browser/browser_about_handler.h
index 87e5e75..56125ca 100644
--- a/chrome/browser/browser_about_handler.h
+++ b/chrome/browser/browser_about_handler.h
@@ -7,6 +7,13 @@
#ifndef CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_
#define CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_
+#include <map>
+#include <string>
+
+#include "base/process.h"
+#include "base/singleton.h"
+#include "base/string_util.h"
+
class GURL;
class Profile;
@@ -23,4 +30,39 @@ bool WillHandleBrowserAboutURL(GURL* url, Profile* profile);
// case, normal tab navigation should be skipped.
bool HandleNonNavigationAboutURL(const GURL& url);
+#if defined(USE_TCMALLOC)
+// A map of header strings (e.g. "Browser", "Renderer PID 123")
+// to the tcmalloc output collected for each process.
+typedef std::map<std::string, std::string> AboutTcmallocOutputsType;
+
+class AboutTcmallocOutputs {
+ public:
+ AboutTcmallocOutputs() {}
+
+ AboutTcmallocOutputsType* outputs() { return &outputs_; }
+
+ // Records the output for a specified header string.
+ void SetOutput(std::string header, std::string output) {
+ outputs_[header] = output;
+ }
+
+ // Callback for output returned from renderer processes. Adds
+ // the output for a canonical renderer header string that
+ // incorporates the pid.
+ void RendererCallback(base::ProcessId pid, std::string output) {
+ SetOutput(StringPrintf("Renderer PID %d", static_cast<int>(pid)), output);
+ }
+
+ private:
+ AboutTcmallocOutputsType outputs_;
+
+ friend struct DefaultSingletonTraits<AboutTcmallocOutputs>;
+
+ DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs);
+};
+
+// Glue between the callback task and the method in the singleton.
+void AboutTcmallocRendererCallback(base::ProcessId pid, std::string output);
+#endif
+
#endif // CHROME_BROWSER_BROWSER_ABOUT_HANDLER_H_