| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 base::ProcessId pid, | 208 base::ProcessId pid, |
| 209 const ProcessInfoSnapshot& process_info) { | 209 const ProcessInfoSnapshot& process_info) { |
| 210 ProcessMemoryInformation info; | 210 ProcessMemoryInformation info; |
| 211 info.pid = pid; | 211 info.pid = pid; |
| 212 if (info.pid == base::GetCurrentProcId()) | 212 if (info.pid == base::GetCurrentProcId()) |
| 213 info.process_type = content::PROCESS_TYPE_BROWSER; | 213 info.process_type = content::PROCESS_TYPE_BROWSER; |
| 214 else | 214 else |
| 215 info.process_type = content::PROCESS_TYPE_UNKNOWN; | 215 info.process_type = content::PROCESS_TYPE_UNKNOWN; |
| 216 | 216 |
| 217 chrome::VersionInfo version_info; | 217 chrome::VersionInfo version_info; |
| 218 if (version_info.is_valid()) { | 218 info.product_name = base::ASCIIToUTF16(version_info.Name()); |
| 219 info.product_name = base::ASCIIToUTF16(version_info.Name()); | 219 info.version = base::ASCIIToUTF16(version_info.Version()); |
| 220 info.version = base::ASCIIToUTF16(version_info.Version()); | |
| 221 } else { | |
| 222 info.product_name = process_data_[CHROME_BROWSER].name; | |
| 223 info.version = base::string16(); | |
| 224 } | |
| 225 | 220 |
| 226 // Check if this is one of the child processes whose data we collected | 221 // Check if this is one of the child processes whose data we collected |
| 227 // on the IO thread, and if so copy over that data. | 222 // on the IO thread, and if so copy over that data. |
| 228 for (size_t child = 0; child < child_info.size(); child++) { | 223 for (size_t child = 0; child < child_info.size(); child++) { |
| 229 if (child_info[child].pid == info.pid) { | 224 if (child_info[child].pid == info.pid) { |
| 230 info.titles = child_info[child].titles; | 225 info.titles = child_info[child].titles; |
| 231 info.process_type = child_info[child].process_type; | 226 info.process_type = child_info[child].process_type; |
| 232 break; | 227 break; |
| 233 } | 228 } |
| 234 } | 229 } |
| 235 | 230 |
| 236 // Memory info. | 231 // Memory info. |
| 237 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); | 232 process_info.GetCommittedKBytesOfPID(info.pid, &info.committed); |
| 238 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); | 233 process_info.GetWorkingSetKBytesOfPID(info.pid, &info.working_set); |
| 239 | 234 |
| 240 // Add the process info to our list. | 235 // Add the process info to our list. |
| 241 process_data_[CHROME_BROWSER].processes.push_back(info); | 236 process_data_[CHROME_BROWSER].processes.push_back(info); |
| 242 } | 237 } |
| OLD | NEW |