Broke ContentSettingBubbleModelTest.Plugins on Android.
[chromium-blink-merge.git] / content / browser / tcmalloc_internals_request_job.h
blobd74b656a02c78a820bacc7d88b6f462bf483e689
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.
5 #ifndef CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_
6 #define CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_
8 #include <map>
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"
16 namespace content {
18 class AboutTcmallocOutputs {
19 public:
20 // Returns the singleton instance.
21 static AboutTcmallocOutputs* GetInstance();
23 // Records the output for a specified header string.
24 void SetOutput(const std::string& header, const std::string& output);
26 void DumpToHTMLTable(std::string* data);
28 // Callback for output returned from a child process. Adds
29 // the output for a canonical process-specific header string that
30 // incorporates the pid.
31 void OnStatsForChildProcess(base::ProcessId pid,
32 ProcessType process_type,
33 const std::string& output);
35 private:
36 AboutTcmallocOutputs();
37 ~AboutTcmallocOutputs();
39 // A map of header strings (e.g. "Browser", "Renderer PID 123")
40 // to the tcmalloc output collected for each process.
41 typedef std::map<std::string, std::string> AboutTcmallocOutputsType;
42 AboutTcmallocOutputsType outputs_;
44 friend struct DefaultSingletonTraits<AboutTcmallocOutputs>;
46 DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs);
49 class TcmallocInternalsRequestJob : public net::URLRequestSimpleJob {
50 public:
51 TcmallocInternalsRequestJob(net::URLRequest* request,
52 net::NetworkDelegate* network_delegate);
54 virtual int GetData(std::string* mime_type,
55 std::string* charset,
56 std::string* data,
57 const net::CompletionCallback& callback) const OVERRIDE;
59 protected:
60 virtual ~TcmallocInternalsRequestJob() {}
62 private:
63 DISALLOW_IMPLICIT_CONSTRUCTORS(TcmallocInternalsRequestJob);
66 } // namespace content
68 #endif // CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_