OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/task_manager/task_manager_os_resources_win.h" | |
6 | |
7 void GetWinGDIHandles(base::ProcessHandle process, | |
8 size_t* current, | |
9 size_t* peak) { | |
10 *current = 0; | |
11 *peak = 0; | |
12 // Get a handle to |process| that has PROCESS_QUERY_INFORMATION rights. | |
13 HANDLE current_process = GetCurrentProcess(); | |
14 HANDLE process_with_query_rights; | |
15 if (DuplicateHandle(current_process, process, current_process, | |
16 &process_with_query_rights, PROCESS_QUERY_INFORMATION, | |
17 false, 0)) { | |
18 *current = GetGuiResources(process_with_query_rights, GR_GDIOBJECTS); | |
19 *peak = GetGuiResources(process_with_query_rights, GR_GDIOBJECTS_PEAK); | |
20 CloseHandle(process_with_query_rights); | |
21 } | |
22 } | |
23 | |
24 void GetWinUSERHandles(base::ProcessHandle process, | |
25 size_t* current, | |
26 size_t* peak) { | |
27 *current = 0; | |
28 *peak = 0; | |
29 // Get a handle to |process| that has PROCESS_QUERY_INFORMATION rights. | |
30 HANDLE current_process = GetCurrentProcess(); | |
31 HANDLE process_with_query_rights; | |
32 if (DuplicateHandle(current_process, process, current_process, | |
33 &process_with_query_rights, PROCESS_QUERY_INFORMATION, | |
34 false, 0)) { | |
35 *current = GetGuiResources(process_with_query_rights, GR_USEROBJECTS); | |
36 *peak = GetGuiResources(process_with_query_rights, GR_USEROBJECTS_PEAK); | |
37 CloseHandle(process_with_query_rights); | |
38 } | |
39 } | |
OLD | NEW |