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

Side by Side Diff: base/process_util_win.cc

Issue 10134001: Make sure that base::MessagePumpForUI from different modules are isolated from each other and add p… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 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
« base/message_pump_win.cc ('K') | « base/process_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <io.h> 8 #include <io.h>
9 #include <windows.h> 9 #include <windows.h>
10 #include <userenv.h> 10 #include <userenv.h>
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 ProcessId GetCurrentProcId() { 170 ProcessId GetCurrentProcId() {
171 return ::GetCurrentProcessId(); 171 return ::GetCurrentProcessId();
172 } 172 }
173 173
174 ProcessHandle GetCurrentProcessHandle() { 174 ProcessHandle GetCurrentProcessHandle() {
175 return ::GetCurrentProcess(); 175 return ::GetCurrentProcess();
176 } 176 }
177 177
178 HMODULE GetModuleFromAddress(void* address) { 178 HMODULE GetModuleFromAddress(void* address) {
179 HMODULE hinst = NULL; 179 HMODULE instance = NULL;
180 if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, 180 if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
181 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
181 static_cast<char*>(address), 182 static_cast<char*>(address),
182 &hinst)) { 183 &instance)) {
183 NOTREACHED(); 184 NOTREACHED();
184 } 185 }
185 return hinst; 186 return instance;
186 } 187 }
187 188
188 bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle) { 189 bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle) {
189 // We try to limit privileges granted to the handle. If you need this 190 // We try to limit privileges granted to the handle. If you need this
190 // for test code, consider using OpenPrivilegedProcessHandle instead of 191 // for test code, consider using OpenPrivilegedProcessHandle instead of
191 // adding more privileges here. 192 // adding more privileges here.
192 ProcessHandle result = OpenProcess(PROCESS_DUP_HANDLE | PROCESS_TERMINATE, 193 ProcessHandle result = OpenProcess(PROCESS_DUP_HANDLE | PROCESS_TERMINATE,
193 FALSE, pid); 194 FALSE, pid);
194 195
195 if (result == NULL) 196 if (result == NULL)
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 996
996 PERFORMANCE_INFORMATION info; 997 PERFORMANCE_INFORMATION info;
997 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 998 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
998 DLOG(ERROR) << "Failed to fetch internal performance info."; 999 DLOG(ERROR) << "Failed to fetch internal performance info.";
999 return 0; 1000 return 0;
1000 } 1001 }
1001 return (info.CommitTotal * system_info.dwPageSize) / 1024; 1002 return (info.CommitTotal * system_info.dwPageSize) / 1024;
1002 } 1003 }
1003 1004
1004 } // namespace base 1005 } // namespace base
OLDNEW
« base/message_pump_win.cc ('K') | « base/process_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698