OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ | |
6 #define CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/memory/singleton.h" | |
11 #include "base/process.h" | |
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" | |
15 #include <map> | |
jam
2012/04/24 20:14:08
nit: this needs to be at the top
| |
16 | |
17 namespace content { | |
18 | |
19 // A map of header strings (e.g. "Browser", "Renderer PID 123") | |
20 // to the tcmalloc output collected for each process. | |
21 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
| |
22 | |
23 class AboutTcmallocOutputs { | |
24 public: | |
25 // Returns the singleton instance. | |
26 static AboutTcmallocOutputs* GetInstance(); | |
27 | |
28 // Records the output for a specified header string. | |
29 void SetOutput(const std::string& header, const std::string& output); | |
30 | |
31 void DumpToHTMLTable(std::string* data); | |
32 | |
33 // Callback for output returned from a child process. Adds | |
34 // the output for a canonical process-specific header string that | |
35 // incorporates the pid. | |
36 void OnStatsForChildProcess(base::ProcessId pid, | |
37 ProcessType process_type, | |
38 const std::string& output); | |
39 | |
40 private: | |
41 AboutTcmallocOutputs(); | |
42 ~AboutTcmallocOutputs(); | |
43 | |
44 AboutTcmallocOutputsType outputs_; | |
45 | |
46 friend struct DefaultSingletonTraits<AboutTcmallocOutputs>; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs); | |
49 }; | |
50 | |
51 class TcmallocInternalsRequestJob : public net::URLRequestSimpleJob { | |
52 public: | |
53 explicit TcmallocInternalsRequestJob(net::URLRequest* request); | |
54 | |
55 virtual bool GetData(std::string* mime_type, | |
56 std::string* charset, | |
57 std::string* data) const OVERRIDE; | |
58 | |
59 private: | |
60 DISALLOW_IMPLICIT_CONSTRUCTORS(TcmallocInternalsRequestJob); | |
61 }; | |
62 | |
63 } // namespace content | |
64 | |
65 #endif // CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_ | |
OLD | NEW |