OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <psapi.h> | 6 #include <psapi.h> |
7 | 7 |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)}; | 78 PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)}; |
79 if (!snapshot.Get()) { | 79 if (!snapshot.Get()) { |
80 LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError(); | 80 LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError(); |
81 return; | 81 return; |
82 } | 82 } |
83 if (!::Process32First(snapshot, &process_entry)) { | 83 if (!::Process32First(snapshot, &process_entry)) { |
84 LOG(ERROR) << "Process32First failed: " << GetLastError(); | 84 LOG(ERROR) << "Process32First failed: " << GetLastError(); |
85 return; | 85 return; |
86 } | 86 } |
87 do { | 87 do { |
88 int pid = process_entry.th32ProcessID; | 88 base::ProcessId pid = process_entry.th32ProcessID; |
89 ScopedHandle handle(::OpenProcess( | 89 ScopedHandle handle(::OpenProcess( |
90 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid)); | 90 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid)); |
91 if (!handle.Get()) | 91 if (!handle.Get()) |
92 continue; | 92 continue; |
93 bool is_64bit_process = false; | 93 bool is_64bit_process = false; |
94 // IsWow64Process() returns FALSE for a 32bit process on a 32bit OS. | 94 // IsWow64Process() returns FALSE for a 32bit process on a 32bit OS. |
95 // We need to check if the real OS is 64bit. | 95 // We need to check if the real OS is 64bit. |
96 if (is_64bit_os) { | 96 if (is_64bit_os) { |
97 BOOL is_wow64 = FALSE; | 97 BOOL is_wow64 = FALSE; |
98 // IsWow64Process() is supported by Windows XP SP2 or later. | 98 // IsWow64Process() is supported by Windows XP SP2 or later. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Add the process info to our list. | 147 // Add the process info to our list. |
148 process_data_[index2].processes.push_back(info); | 148 process_data_[index2].processes.push_back(info); |
149 break; | 149 break; |
150 } | 150 } |
151 } while (::Process32Next(snapshot, &process_entry)); | 151 } while (::Process32Next(snapshot, &process_entry)); |
152 | 152 |
153 // Finally return to the browser thread. | 153 // Finally return to the browser thread. |
154 ui_loop_->PostTask(FROM_HERE, | 154 ui_loop_->PostTask(FROM_HERE, |
155 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); | 155 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); |
156 } | 156 } |
OLD | NEW |