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

Unified Diff: base/debug/gdi_debug_util_win.cc

Issue 2452933002: Collect information on the dump when GetDC fails. (Closed)
Patch Set: Remove excessive check for |header|. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/gdi_debug_util_win.h ('k') | base/win/scoped_hdc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/gdi_debug_util_win.cc
diff --git a/base/debug/gdi_debug_util_win.cc b/base/debug/gdi_debug_util_win.cc
index ce339559eadfe57f11d7ceeeb1e2a3e95b3b73f7..535424ac1ffde7514979a0f333809b0abdb0f70c 100644
--- a/base/debug/gdi_debug_util_win.cc
+++ b/base/debug/gdi_debug_util_win.cc
@@ -12,6 +12,7 @@
#include "base/debug/alias.h"
#include "base/logging.h"
#include "base/win/scoped_handle.h"
+#include "base/win/win_util.h"
namespace {
@@ -64,16 +65,18 @@ void CollectChildGDIUsageAndDie(DWORD parent_pid) {
namespace base {
namespace debug {
-void GDIBitmapAllocFailure(BITMAPINFOHEADER* header, HANDLE shared_section) {
+void CollectGDIUsageAndDie(BITMAPINFOHEADER* header, HANDLE shared_section) {
// Make sure parameters are saved in the minidump.
DWORD last_error = GetLastError();
+ bool is_gdi_available = base::win::IsUser32AndGdi32Available();
- LONG width = header->biWidth;
- LONG heigth = header->biHeight;
+ LONG width = header ? header->biWidth : 0;
+ LONG height = header ? header->biHeight : 0;
base::debug::Alias(&last_error);
+ base::debug::Alias(&is_gdi_available);
base::debug::Alias(&width);
- base::debug::Alias(&heigth);
+ base::debug::Alias(&height);
base::debug::Alias(&shared_section);
DWORD num_user_handles = GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS);
@@ -100,19 +103,19 @@ void GDIBitmapAllocFailure(BITMAPINFOHEADER* header, HANDLE shared_section) {
CHECK_LE(pmc.PagefileUsage, kLotsOfMemory);
CHECK_LE(pmc.PrivateUsage, kLotsOfMemory);
- void* small_data = NULL;
+ void* small_data = nullptr;
base::debug::Alias(&small_data);
- if (std::abs(heigth) * width > 100) {
+ if (std::abs(height) * width > 100) {
// Huh, that's weird. We don't have crazy handle count, we don't have
// ridiculous memory usage. Try to allocate a small bitmap and see if that
// fails too.
header->biWidth = 5;
header->biHeight = -5;
HBITMAP small_bitmap = CreateDIBSection(
- NULL, reinterpret_cast<BITMAPINFO*>(&header),
+ nullptr, reinterpret_cast<BITMAPINFO*>(&header),
0, &small_data, shared_section, 0);
- CHECK(small_bitmap != NULL);
+ CHECK(small_bitmap != nullptr);
DeleteObject(small_bitmap);
}
// Maybe the child processes are the ones leaking GDI or USER resouces.
« no previous file with comments | « base/debug/gdi_debug_util_win.h ('k') | base/win/scoped_hdc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698