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 #include "content/browser/tcmalloc_internals_request_job.h" | 5 #include "content/browser/tcmalloc_internals_request_job.h" |
6 | 6 |
7 #include "base/allocator/allocator_extension.h" | 7 #include "base/allocator/allocator_extension.h" |
8 #include "content/common/child_process_messages.h" | 8 #include "content/common/child_process_messages.h" |
9 #include "content/public/browser/browser_child_process_host_iterator.h" | 9 #include "content/public/browser/browser_child_process_host_iterator.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 void AboutTcmallocOutputs::OnStatsForChildProcess( | 26 void AboutTcmallocOutputs::OnStatsForChildProcess( |
27 base::ProcessId pid, int process_type, | 27 base::ProcessId pid, int process_type, |
28 const std::string& output) { | 28 const std::string& output) { |
29 std::string header = GetProcessTypeNameInEnglish(process_type); | 29 std::string header = GetProcessTypeNameInEnglish(process_type); |
30 base::StringAppendF(&header, " PID %d", static_cast<int>(pid)); | 30 base::StringAppendF(&header, " PID %d", static_cast<int>(pid)); |
31 SetOutput(header, output); | 31 SetOutput(header, output); |
32 } | 32 } |
33 | 33 |
34 void AboutTcmallocOutputs::SetOutput(const std::string& header, | 34 void AboutTcmallocOutputs::SetOutput(const std::string& header, |
35 const std::string& output) { | 35 const std::string& output) { |
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 36 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
37 | 37 |
38 outputs_[header] = output; | 38 outputs_[header] = output; |
39 } | 39 } |
40 | 40 |
41 void AboutTcmallocOutputs::DumpToHTMLTable(std::string* data) { | 41 void AboutTcmallocOutputs::DumpToHTMLTable(std::string* data) { |
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 42 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
43 | 43 |
44 data->append("<table width=\"100%\">\n"); | 44 data->append("<table width=\"100%\">\n"); |
45 for (AboutTcmallocOutputsType::const_iterator oit = outputs_.begin(); | 45 for (AboutTcmallocOutputsType::const_iterator oit = outputs_.begin(); |
46 oit != outputs_.end(); | 46 oit != outputs_.end(); |
47 oit++) { | 47 oit++) { |
48 data->append("<tr><td bgcolor=\"yellow\">"); | 48 data->append("<tr><td bgcolor=\"yellow\">"); |
49 data->append(oit->first); | 49 data->append(oit->first); |
50 data->append("</td></tr>\n"); | 50 data->append("</td></tr>\n"); |
51 data->append("<tr><td><pre>\n"); | 51 data->append("<tr><td><pre>\n"); |
52 data->append(oit->second); | 52 data->append(oit->second); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 charset->assign("UTF8"); | 112 charset->assign("UTF8"); |
113 | 113 |
114 data->clear(); | 114 data->clear(); |
115 #if defined(USE_TCMALLOC) | 115 #if defined(USE_TCMALLOC) |
116 AboutTcmalloc(data); | 116 AboutTcmalloc(data); |
117 #endif | 117 #endif |
118 return net::OK; | 118 return net::OK; |
119 } | 119 } |
120 | 120 |
121 } // namespace content | 121 } // namespace content |
OLD | NEW |