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

Side by Side Diff: chrome/browser/memory_details_win.cc

Issue 6816024: Revert 80819 due to failed tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_version_info.h" 10 #include "base/file_version_info.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 void MemoryDetails::CollectProcessData( 67 void MemoryDetails::CollectProcessData(
68 const std::vector<ProcessMemoryInformation>& child_info) { 68 const std::vector<ProcessMemoryInformation>& child_info) {
69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
70 70
71 // Clear old data. 71 // Clear old data.
72 for (unsigned int index = 0; index < process_data_.size(); index++) 72 for (unsigned int index = 0; index < process_data_.size(); index++)
73 process_data_[index].processes.clear(); 73 process_data_[index].processes.clear();
74 74
75 base::win::OSInfo::WindowsArchitecture windows_architecture = 75 base::win::WindowsArchitecture windows_architecture =
76 base::win::OSInfo::GetInstance()->architecture(); 76 base::win::GetWindowsArchitecture();
77 77
78 base::win::ScopedHandle snapshot( 78 base::win::ScopedHandle snapshot(
79 ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); 79 ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
80 PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)}; 80 PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)};
81 if (!snapshot.Get()) { 81 if (!snapshot.Get()) {
82 LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError(); 82 LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError();
83 return; 83 return;
84 } 84 }
85 if (!::Process32First(snapshot, &process_entry)) { 85 if (!::Process32First(snapshot, &process_entry)) {
86 LOG(ERROR) << "Process32First failed: " << GetLastError(); 86 LOG(ERROR) << "Process32First failed: " << GetLastError();
87 return; 87 return;
88 } 88 }
89 do { 89 do {
90 base::ProcessId pid = process_entry.th32ProcessID; 90 base::ProcessId pid = process_entry.th32ProcessID;
91 base::win::ScopedHandle process_handle(::OpenProcess( 91 base::win::ScopedHandle process_handle(::OpenProcess(
92 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid)); 92 PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
93 if (!process_handle.Get()) 93 if (!process_handle.Get())
94 continue; 94 continue;
95 bool is_64bit_process = 95 bool is_64bit_process =
96 ((windows_architecture == base::win::OSInfo::X64_ARCHITECTURE) || 96 ((windows_architecture == base::win::X64_ARCHITECTURE) ||
97 (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE)) && 97 (windows_architecture == base::win::IA64_ARCHITECTURE)) &&
98 (base::win::OSInfo::GetWOW64StatusForProcess(process_handle) == 98 (base::win::GetWOW64StatusForProcess(process_handle) ==
99 base::win::OSInfo::WOW64_DISABLED); 99 base::win::WOW64_DISABLED);
100 for (unsigned int index2 = 0; index2 < process_data_.size(); index2++) { 100 for (unsigned int index2 = 0; index2 < process_data_.size(); index2++) {
101 if (_wcsicmp(process_data_[index2].process_name.c_str(), 101 if (_wcsicmp(process_data_[index2].process_name.c_str(),
102 process_entry.szExeFile) != 0) 102 process_entry.szExeFile) != 0)
103 continue; 103 continue;
104 if (index2 == IE_BROWSER && is_64bit_process) 104 if (index2 == IE_BROWSER && is_64bit_process)
105 continue; // Should use IE_64BIT_BROWSER 105 continue; // Should use IE_64BIT_BROWSER
106 // Get Memory Information. 106 // Get Memory Information.
107 ProcessMemoryInformation info; 107 ProcessMemoryInformation info;
108 info.pid = pid; 108 info.pid = pid;
109 if (info.pid == GetCurrentProcessId()) 109 if (info.pid == GetCurrentProcessId())
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 break; 152 break;
153 } 153 }
154 } while (::Process32Next(snapshot, &process_entry)); 154 } while (::Process32Next(snapshot, &process_entry));
155 155
156 // Finally return to the browser thread. 156 // Finally return to the browser thread.
157 BrowserThread::PostTask( 157 BrowserThread::PostTask(
158 BrowserThread::UI, FROM_HERE, 158 BrowserThread::UI, FROM_HERE,
159 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread)); 159 NewRunnableMethod(this, &MemoryDetails::CollectChildInfoOnUIThread));
160 } 160 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer_unittest.cc ('k') | chrome/browser/nacl_host/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698