| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ | 5 #ifndef CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ |
| 6 #define CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ | 6 #define CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "base/process.h" | 11 #include "base/process.h" |
| 12 #include "build/build_config.h" // USE_TCMALLOC | 12 #include "build/build_config.h" // USE_TCMALLOC |
| 13 #include "content/public/common/process_type.h" | |
| 14 #include "net/url_request/url_request_simple_job.h" | 13 #include "net/url_request/url_request_simple_job.h" |
| 15 | 14 |
| 16 namespace content { | 15 namespace content { |
| 17 | 16 |
| 18 class AboutTcmallocOutputs { | 17 class AboutTcmallocOutputs { |
| 19 public: | 18 public: |
| 20 // Returns the singleton instance. | 19 // Returns the singleton instance. |
| 21 static AboutTcmallocOutputs* GetInstance(); | 20 static AboutTcmallocOutputs* GetInstance(); |
| 22 | 21 |
| 23 // Records the output for a specified header string. | 22 // Records the output for a specified header string. |
| 24 void SetOutput(const std::string& header, const std::string& output); | 23 void SetOutput(const std::string& header, const std::string& output); |
| 25 | 24 |
| 26 void DumpToHTMLTable(std::string* data); | 25 void DumpToHTMLTable(std::string* data); |
| 27 | 26 |
| 28 // Callback for output returned from a child process. Adds | 27 // Callback for output returned from a child process. Adds |
| 29 // the output for a canonical process-specific header string that | 28 // the output for a canonical process-specific header string that |
| 30 // incorporates the pid. | 29 // incorporates the pid. |
| 31 void OnStatsForChildProcess(base::ProcessId pid, | 30 void OnStatsForChildProcess(base::ProcessId pid, |
| 32 ProcessType process_type, | 31 int process_type, |
| 33 const std::string& output); | 32 const std::string& output); |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 AboutTcmallocOutputs(); | 35 AboutTcmallocOutputs(); |
| 37 ~AboutTcmallocOutputs(); | 36 ~AboutTcmallocOutputs(); |
| 38 | 37 |
| 39 // A map of header strings (e.g. "Browser", "Renderer PID 123") | 38 // A map of header strings (e.g. "Browser", "Renderer PID 123") |
| 40 // to the tcmalloc output collected for each process. | 39 // to the tcmalloc output collected for each process. |
| 41 typedef std::map<std::string, std::string> AboutTcmallocOutputsType; | 40 typedef std::map<std::string, std::string> AboutTcmallocOutputsType; |
| 42 AboutTcmallocOutputsType outputs_; | 41 AboutTcmallocOutputsType outputs_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 protected: | 58 protected: |
| 60 virtual ~TcmallocInternalsRequestJob() {} | 59 virtual ~TcmallocInternalsRequestJob() {} |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 DISALLOW_IMPLICIT_CONSTRUCTORS(TcmallocInternalsRequestJob); | 62 DISALLOW_IMPLICIT_CONSTRUCTORS(TcmallocInternalsRequestJob); |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 } // namespace content | 65 } // namespace content |
| 67 | 66 |
| 68 #endif // CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ | 67 #endif // CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ |
| OLD | NEW |