Give names to all utility processes.
[chromium-blink-merge.git] / chrome / browser / task_manager / os_resource_win.cc
blob0ca678757089ec26db7aa73ae19d6bd8fb1b9b57
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.
5 #include "chrome/browser/task_manager/os_resource_win.h"
7 namespace task_manager {
9 void GetWinGDIHandles(base::ProcessHandle process,
10 size_t* current,
11 size_t* peak) {
12 *current = 0;
13 *peak = 0;
14 // Get a handle to |process| that has PROCESS_QUERY_INFORMATION rights.
15 HANDLE current_process = GetCurrentProcess();
16 HANDLE process_with_query_rights;
17 if (DuplicateHandle(current_process, process, current_process,
18 &process_with_query_rights, PROCESS_QUERY_INFORMATION,
19 false, 0)) {
20 *current = GetGuiResources(process_with_query_rights, GR_GDIOBJECTS);
21 *peak = GetGuiResources(process_with_query_rights, GR_GDIOBJECTS_PEAK);
22 CloseHandle(process_with_query_rights);
26 void GetWinUSERHandles(base::ProcessHandle process,
27 size_t* current,
28 size_t* peak) {
29 *current = 0;
30 *peak = 0;
31 // Get a handle to |process| that has PROCESS_QUERY_INFORMATION rights.
32 HANDLE current_process = GetCurrentProcess();
33 HANDLE process_with_query_rights;
34 if (DuplicateHandle(current_process, process, current_process,
35 &process_with_query_rights, PROCESS_QUERY_INFORMATION,
36 false, 0)) {
37 *current = GetGuiResources(process_with_query_rights, GR_USEROBJECTS);
38 *peak = GetGuiResources(process_with_query_rights, GR_USEROBJECTS_PEAK);
39 CloseHandle(process_with_query_rights);
43 } // namespace task_manager