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

Unified Diff: content/browser/tcmalloc_internals_request_job.h

Issue 10041017: Show gpu process stats in about:tcmalloc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
Index: content/browser/tcmalloc_internals_request_job.h
diff --git a/content/browser/tcmalloc_internals_request_job.h b/content/browser/tcmalloc_internals_request_job.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d040eaf013ae1da0018bff163c57f0b17e830bc
--- /dev/null
+++ b/content/browser/tcmalloc_internals_request_job.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_
+#define CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/memory/singleton.h"
+#include "base/process.h"
+#include "build/build_config.h" // USE_TCMALLOC
+#include "content/public/common/process_type.h"
+#include "net/url_request/url_request_simple_job.h"
+#include <map>
jam 2012/04/24 20:14:08 nit: this needs to be at the top
+
+namespace content {
+
+// 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;
jam 2012/04/24 20:14:08 nit: make this private if only this class is using
+
+class AboutTcmallocOutputs {
+ public:
+ // Returns the singleton instance.
+ static AboutTcmallocOutputs* GetInstance();
+
+ // Records the output for a specified header string.
+ void SetOutput(const std::string& header, const std::string& output);
+
+ void DumpToHTMLTable(std::string* data);
+
+ // Callback for output returned from a child process. Adds
+ // the output for a canonical process-specific header string that
+ // incorporates the pid.
+ void OnStatsForChildProcess(base::ProcessId pid,
+ ProcessType process_type,
+ const std::string& output);
+
+ private:
+ AboutTcmallocOutputs();
+ ~AboutTcmallocOutputs();
+
+ AboutTcmallocOutputsType outputs_;
+
+ friend struct DefaultSingletonTraits<AboutTcmallocOutputs>;
+
+ DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs);
+};
+
+class TcmallocInternalsRequestJob : public net::URLRequestSimpleJob {
+ public:
+ explicit TcmallocInternalsRequestJob(net::URLRequest* request);
+
+ virtual bool GetData(std::string* mime_type,
+ std::string* charset,
+ std::string* data) const OVERRIDE;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TcmallocInternalsRequestJob);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_

Powered by Google App Engine
This is Rietveld 408576698