| 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 <psapi.h> | 7 #include <psapi.h> |
| 8 #include <TlHelp32.h> | 8 #include <TlHelp32.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 scoped_ptr<base::ProcessMetrics> metrics; | 117 scoped_ptr<base::ProcessMetrics> metrics; |
| 118 metrics.reset(base::ProcessMetrics::CreateProcessMetrics( | 118 metrics.reset(base::ProcessMetrics::CreateProcessMetrics( |
| 119 process_handle.Get())); | 119 process_handle.Get())); |
| 120 metrics->GetCommittedKBytes(&info.committed); | 120 metrics->GetCommittedKBytes(&info.committed); |
| 121 metrics->GetWorkingSetKBytes(&info.working_set); | 121 metrics->GetWorkingSetKBytes(&info.working_set); |
| 122 | 122 |
| 123 // Get Version Information. | 123 // Get Version Information. |
| 124 TCHAR name[MAX_PATH]; | 124 TCHAR name[MAX_PATH]; |
| 125 if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) { | 125 if (index2 == CHROME_BROWSER || index2 == CHROME_NACL_PROCESS) { |
| 126 chrome::VersionInfo version_info; | 126 chrome::VersionInfo version_info; |
| 127 if (version_info.is_valid()) | 127 info.version = base::ASCIIToWide(version_info.Version()); |
| 128 info.version = base::ASCIIToWide(version_info.Version()); | |
| 129 // Check if this is one of the child processes whose data we collected | 128 // Check if this is one of the child processes whose data we collected |
| 130 // on the IO thread, and if so copy over that data. | 129 // on the IO thread, and if so copy over that data. |
| 131 for (size_t child = 0; child < child_info.size(); child++) { | 130 for (size_t child = 0; child < child_info.size(); child++) { |
| 132 if (child_info[child].pid != info.pid) | 131 if (child_info[child].pid != info.pid) |
| 133 continue; | 132 continue; |
| 134 info.titles = child_info[child].titles; | 133 info.titles = child_info[child].titles; |
| 135 info.process_type = child_info[child].process_type; | 134 info.process_type = child_info[child].process_type; |
| 136 break; | 135 break; |
| 137 } | 136 } |
| 138 } else if (GetModuleFileNameEx(process_handle.Get(), NULL, name, | 137 } else if (GetModuleFileNameEx(process_handle.Get(), NULL, name, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 155 } | 154 } |
| 156 break; | 155 break; |
| 157 } | 156 } |
| 158 } while (::Process32Next(snapshot.Get(), &process_entry)); | 157 } while (::Process32Next(snapshot.Get(), &process_entry)); |
| 159 | 158 |
| 160 // Finally return to the browser thread. | 159 // Finally return to the browser thread. |
| 161 BrowserThread::PostTask( | 160 BrowserThread::PostTask( |
| 162 BrowserThread::UI, FROM_HERE, | 161 BrowserThread::UI, FROM_HERE, |
| 163 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); | 162 base::Bind(&MemoryDetails::CollectChildInfoOnUIThread, this)); |
| 164 } | 163 } |
| OLD | NEW |