OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <unistd.h> | 7 #include <unistd.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <dirent.h> | 9 #include <dirent.h> |
10 | 10 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if (!found_parent) | 233 if (!found_parent) |
234 browsers_found.insert(i->pid); | 234 browsers_found.insert(i->pid); |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 std::vector<pid_t> current_browser_processes; | 238 std::vector<pid_t> current_browser_processes; |
239 const pid_t zygote = ZygoteHost::GetInstance()->pid(); | 239 const pid_t zygote = ZygoteHost::GetInstance()->pid(); |
240 GetAllChildren(processes, getpid(), zygote, ¤t_browser_processes); | 240 GetAllChildren(processes, getpid(), zygote, ¤t_browser_processes); |
241 ProcessData current_browser; | 241 ProcessData current_browser; |
242 GetProcessDataMemoryInformation(current_browser_processes, ¤t_browser); | 242 GetProcessDataMemoryInformation(current_browser_processes, ¤t_browser); |
243 current_browser.name = chrome::kBrowserAppName; | 243 current_browser.name = WideToUTF16(chrome::kBrowserAppName); |
244 current_browser.process_name = L"chrome"; | 244 current_browser.process_name = ASCIIToUTF16("chrome"); |
245 process_data_.push_back(current_browser); | 245 process_data_.push_back(current_browser); |
246 | 246 |
247 // For each browser process, collect a list of its children and get the | 247 // For each browser process, collect a list of its children and get the |
248 // memory usage of each. | 248 // memory usage of each. |
249 for (std::set<pid_t>::const_iterator | 249 for (std::set<pid_t>::const_iterator |
250 i = browsers_found.begin(); i != browsers_found.end(); ++i) { | 250 i = browsers_found.begin(); i != browsers_found.end(); ++i) { |
251 std::vector<pid_t> browser_processes; | 251 std::vector<pid_t> browser_processes; |
252 GetAllChildren(processes, *i, 0, &browser_processes); | 252 GetAllChildren(processes, *i, 0, &browser_processes); |
253 ProcessData browser; | 253 ProcessData browser; |
254 GetProcessDataMemoryInformation(browser_processes, &browser); | 254 GetProcessDataMemoryInformation(browser_processes, &browser); |
255 | 255 |
256 for (std::vector<Process>::const_iterator | 256 for (std::vector<Process>::const_iterator |
257 j = processes.begin(); j != processes.end(); ++j) { | 257 j = processes.begin(); j != processes.end(); ++j) { |
258 if (j->pid == *i) { | 258 if (j->pid == *i) { |
259 BrowserType type = GetBrowserType(j->name); | 259 BrowserType type = GetBrowserType(j->name); |
260 if (type != MAX_BROWSERS) | 260 if (type != MAX_BROWSERS) |
261 browser.name = ASCIIToWide(kBrowserPrettyNames[type]); | 261 browser.name = ASCIIToUTF16(kBrowserPrettyNames[type]); |
262 break; | 262 break; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 process_data_.push_back(browser); | 266 process_data_.push_back(browser); |
267 } | 267 } |
268 | 268 |
269 // Finally return to the browser thread. | 269 // Finally return to the browser thread. |
270 BrowserThread::PostTask( | 270 BrowserThread::PostTask( |
271 BrowserThread::UI, FROM_HERE, | 271 BrowserThread::UI, FROM_HERE, |
272 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); | 272 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); |
273 } | 273 } |
OLD | NEW |