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 std::string helper_name_eh = chrome::kHelperProcessExecutableName; |
| 121 helper_name_eh.append(" EH"); |
| 122 helper_names.push_back(helper_name_eh); |
| 123 std::string helper_name_pe = chrome::kHelperProcessExecutableName; |
| 124 helper_name_pe.append(" PE"); |
| 125 helper_names.push_back(helper_name_pe); |
| 126 |
116 // Get PIDs of helpers. | 127 // Get PIDs of helpers. |
117 std::vector<base::ProcessId> helper_pids; | 128 std::vector<base::ProcessId> helper_pids; |
118 { | 129 for (size_t i = 0; i < helper_names.size(); ++i) { |
119 base::NamedProcessIterator helper_it(chrome::kHelperProcessExecutableName, | 130 std::string helper_name = helper_names[i]; |
120 NULL); | 131 base::NamedProcessIterator helper_it(helper_name, NULL); |
121 while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) { | 132 while (const base::ProcessEntry* entry = helper_it.NextProcessEntry()) { |
122 helper_pids.push_back(entry->pid()); | 133 helper_pids.push_back(entry->pid()); |
123 all_pids.push_back(entry->pid()); | 134 all_pids.push_back(entry->pid()); |
124 } | 135 } |
125 } | 136 } |
126 | 137 |
127 // Capture information about the processes we're interested in. | 138 // Capture information about the processes we're interested in. |
128 ProcessInfoSnapshot process_info; | 139 ProcessInfoSnapshot process_info; |
129 process_info.Sample(all_pids); | 140 process_info.Sample(all_pids); |
130 | 141 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 230 } |
220 } | 231 } |
221 | 232 |
222 // Memory info. | 233 // Memory info. |
223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); | 234 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); |
224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); | 235 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); |
225 | 236 |
226 // Add the process info to our list. | 237 // Add the process info to our list. |
227 process_data_[CHROME_BROWSER].processes.push_back(info); | 238 process_data_[CHROME_BROWSER].processes.push_back(info); |
228 } | 239 } |
OLD | NEW |