| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 for (size_t index = CHROME_BROWSER; index < MAX_BROWSERS; index++) { | 106 for (size_t index = CHROME_BROWSER; index < MAX_BROWSERS; index++) { |
| 107 base::NamedProcessIterator process_it( | 107 base::NamedProcessIterator process_it( |
| 108 UTF16ToUTF8(process_data_[index].process_name), NULL); | 108 UTF16ToUTF8(process_data_[index].process_name), NULL); |
| 109 | 109 |
| 110 while (const base::ProcessEntry* entry = process_it.NextProcessEntry()) { | 110 while (const base::ProcessEntry* entry = process_it.NextProcessEntry()) { |
| 111 pids_by_browser[index].push_back(entry->pid()); | 111 pids_by_browser[index].push_back(entry->pid()); |
| 112 all_pids.push_back(entry->pid()); | 112 all_pids.push_back(entry->pid()); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 // The helper might show up as these different flavors depending on the |
| 117 // executable flags required. |
| 118 std::vector<std::string> helper_names; |
| 119 helper_names.push_back(chrome::kHelperProcessExecutableName); |
| 120 for (const char* const* suffix = chrome::kHelperFlavorSuffixes; |
| 121 *suffix; |
| 122 ++suffix) { |
| 123 std::string helper_name = chrome::kHelperProcessExecutableName; |
| 124 helper_name.append(1, ' '); |
| 125 helper_name.append(*suffix); |
| 126 helper_names.push_back(helper_name); |
| 127 } |
| 128 |
| 116 // Get PIDs of helpers. | 129 // Get PIDs of helpers. |
| 117 std::vector<base::ProcessId> helper_pids; | 130 std::vector<base::ProcessId> helper_pids; |
| 118 { | 131 for (size_t i = 0; i < helper_names.size(); ++i) { |
| 119 base::NamedProcessIterator helper_it(chrome::kHelperProcessExecutableName, | 132 std::string helper_name = helper_names[i]; |
| 120 NULL); | 133 base::NamedProcessIterator helper_it(helper_name, NULL); |
| 121 while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) { | 134 while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) { |
| 122 helper_pids.push_back(entry->pid()); | 135 helper_pids.push_back(entry->pid()); |
| 123 all_pids.push_back(entry->pid()); | 136 all_pids.push_back(entry->pid()); |
| 124 } | 137 } |
| 125 } | 138 } |
| 126 | 139 |
| 127 // Capture information about the processes we're interested in. | 140 // Capture information about the processes we're interested in. |
| 128 ProcessInfoSnapshot process_info; | 141 ProcessInfoSnapshot process_info; |
| 129 process_info.Sample(all_pids); | 142 process_info.Sample(all_pids); |
| 130 | 143 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 232 } |
| 220 } | 233 } |
| 221 | 234 |
| 222 // Memory info. | 235 // Memory info. |
| 223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); | 236 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); |
| 224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); | 237 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); |
| 225 | 238 |
| 226 // Add the process info to our list. | 239 // Add the process info to our list. |
| 227 process_data_[CHROME_BROWSER].processes.push_back(info); | 240 process_data_[CHROME_BROWSER].processes.push_back(info); |
| 228 } | 241 } |
| OLD | NEW |