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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 base::ProcessId pid, | 194 base::ProcessId pid, |
195 const ProcessInfoSnapshot& process_info) { | 195 const ProcessInfoSnapshot& process_info) { |
196 ProcessMemoryInformation info; | 196 ProcessMemoryInformation info; |
197 info.pid = pid; | 197 info.pid = pid; |
198 if (info.pid == base::GetCurrentProcId()) | 198 if (info.pid == base::GetCurrentProcId()) |
199 info.type = ChildProcessInfo::BROWSER_PROCESS; | 199 info.type = ChildProcessInfo::BROWSER_PROCESS; |
200 else | 200 else |
201 info.type = ChildProcessInfo::UNKNOWN_PROCESS; | 201 info.type = ChildProcessInfo::UNKNOWN_PROCESS; |
202 | 202 |
203 chrome::VersionInfo version_info; | 203 chrome::VersionInfo version_info; |
204 if (version_info.is_valid()) { | 204 info.product_name = ASCIIToWide(version_info.Name()); |
205 info.product_name = ASCIIToWide(version_info.Name()); | 205 info.version = ASCIIToWide(version_info.Version()); |
206 info.version = ASCIIToWide(version_info.Version()); | |
207 } else { | |
208 info.product_name = process_data_[CHROME_BROWSER].name; | |
209 info.version = L""; | |
210 } | |
211 | 206 |
212 // Check if this is one of the child processes whose data we collected | 207 // Check if this is one of the child processes whose data we collected |
213 // on the IO thread, and if so copy over that data. | 208 // on the IO thread, and if so copy over that data. |
214 for (size_t child = 0; child < child_info.size(); child++) { | 209 for (size_t child = 0; child < child_info.size(); child++) { |
215 if (child_info[child].pid == info.pid) { | 210 if (child_info[child].pid == info.pid) { |
216 info.titles = child_info[child].titles; | 211 info.titles = child_info[child].titles; |
217 info.type = child_info[child].type; | 212 info.type = child_info[child].type; |
218 break; | 213 break; |
219 } | 214 } |
220 } | 215 } |
221 | 216 |
222 // Memory info. | 217 // Memory info. |
223 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); | 218 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); |
224 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); | 219 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); |
225 | 220 |
226 // Add the process info to our list. | 221 // Add the process info to our list. |
227 process_data_[CHROME_BROWSER].processes.push_back(info); | 222 process_data_[CHROME_BROWSER].processes.push_back(info); |
228 } | 223 } |
OLD | NEW |