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" |
11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
12 #include "content/public/common/process_type.h" | 12 #include "content/public/common/process_type.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 // static | 17 // static |
18 AboutTcmallocOutputs* AboutTcmallocOutputs::GetInstance() { | 18 AboutTcmallocOutputs* AboutTcmallocOutputs::GetInstance() { |
19 return Singleton<AboutTcmallocOutputs>::get(); | 19 return Singleton<AboutTcmallocOutputs>::get(); |
20 } | 20 } |
21 | 21 |
22 AboutTcmallocOutputs::AboutTcmallocOutputs() {} | 22 AboutTcmallocOutputs::AboutTcmallocOutputs() {} |
23 | 23 |
24 AboutTcmallocOutputs::~AboutTcmallocOutputs() {} | 24 AboutTcmallocOutputs::~AboutTcmallocOutputs() {} |
25 | 25 |
26 void AboutTcmallocOutputs::OnStatsForChildProcess( | 26 void AboutTcmallocOutputs::OnStatsForChildProcess( |
27 base::ProcessId pid, ProcessType 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(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
37 | 37 |
(...skipping 74 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 |