xref: /aosp_15_r20/external/cronet/base/debug/gdi_debug_util_win.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_DEBUG_GDI_DEBUG_UTIL_WIN_H_
6 #define BASE_DEBUG_GDI_DEBUG_UTIL_WIN_H_
7 
8 #include <windows.h>
9 
10 #include "base/base_export.h"
11 
12 namespace base {
13 namespace debug {
14 
15 struct BASE_EXPORT GdiHandleCounts {
16   int dcs = 0;
17   int regions = 0;
18   int bitmaps = 0;
19   int palettes = 0;
20   int fonts = 0;
21   int brushes = 0;
22   int pens = 0;
23   int unknown = 0;
24   int total_tracked = 0;
25 };
26 
27 // Crashes the process, using base::debug::Alias to leave valuable debugging
28 // information in the crash dump. Pass values for |header| and |shared_section|
29 // in the event of a bitmap allocation failure, to gather information about
30 // those as well.
31 BASE_EXPORT void CollectGDIUsageAndDie(BITMAPINFOHEADER* header = nullptr,
32                                        HANDLE shared_section = nullptr);
33 
34 BASE_EXPORT GdiHandleCounts GetGDIHandleCountsInCurrentProcessForTesting();
35 
36 }  // namespace debug
37 }  // namespace base
38 
39 #endif  // BASE_DEBUG_GDI_DEBUG_UTIL_WIN_H_
40