| OLD | NEW |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 DWORD last_error = GetLastError(); | 68 DWORD last_error = GetLastError(); |
| 69 | 69 |
| 70 LONG width = header->biWidth; | 70 LONG width = header->biWidth; |
| 71 LONG heigth = header->biHeight; | 71 LONG heigth = header->biHeight; |
| 72 | 72 |
| 73 base::debug::Alias(&last_error); | 73 base::debug::Alias(&last_error); |
| 74 base::debug::Alias(&width); | 74 base::debug::Alias(&width); |
| 75 base::debug::Alias(&heigth); | 75 base::debug::Alias(&heigth); |
| 76 base::debug::Alias(&shared_section); | 76 base::debug::Alias(&shared_section); |
| 77 | 77 |
| 78 int num_user_handles = GetGuiResources(GetCurrentProcess(), | 78 DWORD num_user_handles = GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS); |
| 79 GR_USEROBJECTS); | |
| 80 | 79 |
| 81 int num_gdi_handles = GetGuiResources(GetCurrentProcess(), | 80 DWORD num_gdi_handles = GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS); |
| 82 GR_GDIOBJECTS); | |
| 83 if (num_gdi_handles == 0) { | 81 if (num_gdi_handles == 0) { |
| 84 DWORD get_gui_resources_error = GetLastError(); | 82 DWORD get_gui_resources_error = GetLastError(); |
| 85 base::debug::Alias(&get_gui_resources_error); | 83 base::debug::Alias(&get_gui_resources_error); |
| 86 CHECK(false); | 84 CHECK(false); |
| 87 } | 85 } |
| 88 | 86 |
| 89 base::debug::Alias(&num_gdi_handles); | 87 base::debug::Alias(&num_gdi_handles); |
| 90 base::debug::Alias(&num_user_handles); | 88 base::debug::Alias(&num_user_handles); |
| 91 | 89 |
| 92 const DWORD kLotsOfHandles = 9990; | 90 const DWORD kLotsOfHandles = 9990; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 115 0, &small_data, shared_section, 0); | 113 0, &small_data, shared_section, 0); |
| 116 CHECK(small_bitmap != NULL); | 114 CHECK(small_bitmap != NULL); |
| 117 DeleteObject(small_bitmap); | 115 DeleteObject(small_bitmap); |
| 118 } | 116 } |
| 119 // Maybe the child processes are the ones leaking GDI or USER resouces. | 117 // Maybe the child processes are the ones leaking GDI or USER resouces. |
| 120 CollectChildGDIUsageAndDie(GetCurrentProcessId()); | 118 CollectChildGDIUsageAndDie(GetCurrentProcessId()); |
| 121 } | 119 } |
| 122 | 120 |
| 123 } // namespace debug | 121 } // namespace debug |
| 124 } // namespace base | 122 } // namespace base |
| OLD | NEW |