Chromium Code Reviews| 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 bb5e933418d7df97cab90fe41edfda5cb5dc190d..92627faf5140915adb8d63f7f57b08b3ae695972 100644 |
| --- a/base/debug/gdi_debug_util_win.cc |
| +++ b/base/debug/gdi_debug_util_win.cc |
| @@ -20,6 +20,15 @@ void CollectChildGDIUsageAndDie(DWORD parent_pid) { |
| HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
| CHECK_NE(INVALID_HANDLE_VALUE, snapshot); |
| + int total_process_count = 0; |
| + base::debug::Alias(&total_process_count); |
| + int total_peak_gdi_count = 0; |
| + base::debug::Alias(&total_peak_gdi_count); |
| + int total_gdi_count = 0; |
| + base::debug::Alias(&total_gdi_count); |
| + int total_user_count = 0; |
| + base::debug::Alias(&total_user_count); |
| + |
| int child_count = 0; |
| base::debug::Alias(&child_count); |
| int peak_gdi_count = 0; |
| @@ -34,9 +43,6 @@ void CollectChildGDIUsageAndDie(DWORD parent_pid) { |
| CHECK(Process32First(snapshot, &proc_entry)); |
| do { |
| - if (parent_pid != proc_entry.th32ParentProcessID) |
| - continue; |
| - // Got a child process. Compute GDI usage. |
| base::win::ScopedHandle process( |
| OpenProcess(PROCESS_QUERY_INFORMATION, |
| FALSE, |
| @@ -47,7 +53,17 @@ void CollectChildGDIUsageAndDie(DWORD parent_pid) { |
| int num_gdi_handles = GetGuiResources(process.Get(), GR_GDIOBJECTS); |
| int num_user_handles = GetGuiResources(process.Get(), GR_USEROBJECTS); |
| - // Compute sum and peak counts. |
| + // Compute sum and peak counts for all processes. |
| + ++total_process_count; |
| + total_user_count += num_user_handles; |
| + total_gdi_count += num_gdi_handles; |
| + if (total_peak_gdi_count < num_gdi_handles) |
|
Lei Zhang
2016/11/03 18:53:11
total_peak_gdi_count = std::max(total_peak_gdi_cou
|
| + total_peak_gdi_count = num_gdi_handles; |
| + |
| + if (parent_pid != proc_entry.th32ParentProcessID) |
| + continue; |
| + |
| + // Compute sum and peak counts for child processes. |
| ++child_count; |
| sum_user_count += num_user_handles; |
| sum_gdi_count += num_gdi_handles; |