OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/memory_details.h" | 5 #include "chrome/browser/memory_details.h" |
6 | 6 |
7 #include <dirent.h> | 7 #include <dirent.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/eintr_wrapper.h" | 14 #include "base/eintr_wrapper.h" |
15 #include "base/file_version_info.h" | 15 #include "base/file_version_info.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
21 #include "content/browser/browser_child_process_host.h" | 21 #include "content/browser/browser_child_process_host.h" |
22 #include "content/browser/zygote_host_linux.h" | 22 #include "content/browser/zygote_host_linux.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/common/process_type.h" |
24 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
25 | 26 |
26 using content::BrowserThread; | 27 using content::BrowserThread; |
27 | 28 |
28 // Known browsers which we collect details for. | 29 // Known browsers which we collect details for. |
29 enum BrowserType { | 30 enum BrowserType { |
30 CHROME = 0, | 31 CHROME = 0, |
31 FIREFOX, | 32 FIREFOX, |
32 ICEWEASEL, | 33 ICEWEASEL, |
33 OPERA, | 34 OPERA, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 static void GetProcessDataMemoryInformation( | 152 static void GetProcessDataMemoryInformation( |
152 const std::vector<pid_t>& pids, ProcessData* out) { | 153 const std::vector<pid_t>& pids, ProcessData* out) { |
153 for (std::vector<pid_t>::const_iterator | 154 for (std::vector<pid_t>::const_iterator |
154 i = pids.begin(); i != pids.end(); ++i) { | 155 i = pids.begin(); i != pids.end(); ++i) { |
155 ProcessMemoryInformation pmi; | 156 ProcessMemoryInformation pmi; |
156 | 157 |
157 pmi.pid = *i; | 158 pmi.pid = *i; |
158 pmi.num_processes = 1; | 159 pmi.num_processes = 1; |
159 | 160 |
160 if (pmi.pid == base::GetCurrentProcId()) | 161 if (pmi.pid == base::GetCurrentProcId()) |
161 pmi.type = ChildProcessInfo::BROWSER_PROCESS; | 162 pmi.type = content::PROCESS_TYPE_BROWSER; |
162 else | 163 else |
163 pmi.type = ChildProcessInfo::UNKNOWN_PROCESS; | 164 pmi.type = content::PROCESS_TYPE_UNKNOWN; |
164 | 165 |
165 base::ProcessMetrics* metrics = | 166 base::ProcessMetrics* metrics = |
166 base::ProcessMetrics::CreateProcessMetrics(*i); | 167 base::ProcessMetrics::CreateProcessMetrics(*i); |
167 metrics->GetWorkingSetKBytes(&pmi.working_set); | 168 metrics->GetWorkingSetKBytes(&pmi.working_set); |
168 delete metrics; | 169 delete metrics; |
169 | 170 |
170 out->processes.push_back(pmi); | 171 out->processes.push_back(pmi); |
171 } | 172 } |
172 } | 173 } |
173 | 174 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 283 } |
283 | 284 |
284 process_data_.push_back(browser); | 285 process_data_.push_back(browser); |
285 } | 286 } |
286 | 287 |
287 // Finally return to the browser thread. | 288 // Finally return to the browser thread. |
288 BrowserThread::PostTask( | 289 BrowserThread::PostTask( |
289 BrowserThread::UI, FROM_HERE, | 290 BrowserThread::UI, FROM_HERE, |
290 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); | 291 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); |
291 } | 292 } |
OLD | NEW |