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

Side by Side Diff: base/debug/gdi_debug_util_win.cc

Issue 593113004: Remove implicit HANDLE conversions from base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « no previous file | base/files/file_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "base/debug/gdi_debug_util_win.h" 4 #include "base/debug/gdi_debug_util_win.h"
5 5
6 #include <cmath> 6 #include <cmath>
7 7
8 #include <psapi.h> 8 #include <psapi.h>
9 #include <TlHelp32.h> 9 #include <TlHelp32.h>
10 10
(...skipping 23 matching lines...) Expand all
34 CHECK(false); 34 CHECK(false);
35 35
36 do { 36 do {
37 if (parent_pid != proc_entry.th32ParentProcessID) 37 if (parent_pid != proc_entry.th32ParentProcessID)
38 continue; 38 continue;
39 // Got a child process. Compute GDI usage. 39 // Got a child process. Compute GDI usage.
40 base::win::ScopedHandle process( 40 base::win::ScopedHandle process(
41 ::OpenProcess(PROCESS_QUERY_INFORMATION, 41 ::OpenProcess(PROCESS_QUERY_INFORMATION,
42 FALSE, 42 FALSE,
43 proc_entry.th32ParentProcessID)); 43 proc_entry.th32ParentProcessID));
44 if (!process) 44 if (!process.IsValid())
45 continue; 45 continue;
46 46
47 int num_gdi_handles = ::GetGuiResources(process.Get(), GR_GDIOBJECTS); 47 int num_gdi_handles = ::GetGuiResources(process.Get(), GR_GDIOBJECTS);
48 int num_user_handles = ::GetGuiResources(process.Get(), GR_USEROBJECTS); 48 int num_user_handles = ::GetGuiResources(process.Get(), GR_USEROBJECTS);
49 49
50 // Compute sum and peak counts. 50 // Compute sum and peak counts.
51 ++child_count; 51 ++child_count;
52 sum_user_count += num_user_handles; 52 sum_user_count += num_user_handles;
53 sum_gdi_count += num_gdi_handles; 53 sum_gdi_count += num_gdi_handles;
54 if (peak_gdi_count < num_gdi_handles) 54 if (peak_gdi_count < num_gdi_handles)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 HBITMAP small_bitmap = CreateDIBSection( 120 HBITMAP small_bitmap = CreateDIBSection(
121 NULL, reinterpret_cast<BITMAPINFO*>(&header), 121 NULL, reinterpret_cast<BITMAPINFO*>(&header),
122 0, &small_data, shared_section, 0); 122 0, &small_data, shared_section, 0);
123 } 123 }
124 // Maybe the child processes are the ones leaking GDI or USER resouces. 124 // Maybe the child processes are the ones leaking GDI or USER resouces.
125 CollectChildGDIUsageAndDie(::GetCurrentProcessId()); 125 CollectChildGDIUsageAndDie(::GetCurrentProcessId());
126 } 126 }
127 127
128 } // namespace debug 128 } // namespace debug
129 } // namespace base 129 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/files/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698