Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: chrome/browser/memory_details_win.cc

Issue 6610029: Create a "GetWOW64Status()" utility function and make the rest of the codebas... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/memory_details_win.cc
===================================================================
--- chrome/browser/memory_details_win.cc (revision 76817)
+++ chrome/browser/memory_details_win.cc (working copy)
@@ -11,6 +11,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
+#include "base/win/windows_version.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
#include "content/browser/browser_child_process_host.h"
@@ -89,19 +90,13 @@
}
do {
base::ProcessId pid = process_entry.th32ProcessID;
- base::win::ScopedHandle handle(::OpenProcess(
+ base::win::ScopedHandle process_handle(::OpenProcess(
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
- if (!handle.Get())
+ if (!process_handle.Get())
continue;
- bool is_64bit_process = false;
- // IsWow64Process() returns FALSE for a 32bit process on a 32bit OS.
- // We need to check if the real OS is 64bit.
- if (is_64bit_os) {
- BOOL is_wow64 = FALSE;
- // IsWow64Process() is supported by Windows XP SP2 or later.
- IsWow64Process(handle, &is_wow64);
- is_64bit_process = !is_wow64;
- }
+ bool is_64bit_process = is_64bit_os &&
+ (base::win::GetWOW64StatusForProcess(process_handle) ==
+ base::win::WOW64_DISABLED);
for (unsigned int index2 = 0; index2 < process_data_.size(); index2++) {
if (_wcsicmp(process_data_[index2].process_name.c_str(),
process_entry.szExeFile) != 0)
@@ -117,7 +112,7 @@
info.type = ChildProcessInfo::UNKNOWN_PROCESS;
scoped_ptr<base::ProcessMetrics> metrics;
- metrics.reset(base::ProcessMetrics::CreateProcessMetrics(handle));
+ metrics.reset(base::ProcessMetrics::CreateProcessMetrics(process_handle));
metrics->GetCommittedKBytes(&info.committed);
metrics->GetWorkingSetKBytes(&info.working_set);
@@ -136,7 +131,8 @@
info.type = child_info[child].type;
break;
}
- } else if (GetModuleFileNameEx(handle, NULL, name, MAX_PATH - 1)) {
+ } else if (GetModuleFileNameEx(process_handle, NULL, name,
+ MAX_PATH - 1)) {
std::wstring str_name(name);
scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(FilePath(str_name)));

Powered by Google App Engine
This is Rietveld 408576698