Commit 4f51ec49 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Make aliased variables' scope to function level

It seems minidumps fail to include "reason". My guess
is it's due to its if-else-clause local scope.

Declare these variables at function level, hoping they
will be included in minidumps.

BUG=1060785,1077725
TEST=bots
R=rafael.cintron@microsoft.com

Change-Id: I0a81aee1134c4c69c1d444b6b445b07dc99d9ccc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2515223
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarRafael Cintron <rafael.cintron@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#823427}
parent e21ebcd0
......@@ -135,11 +135,12 @@ bool DirectCompositionChildSurfaceWin::ReleaseDrawTexture(bool will_discard) {
if (dcomp_surface_.Get() == g_current_surface)
g_current_surface = nullptr;
HRESULT hr, device_removed_reason;
if (draw_texture_) {
draw_texture_.Reset();
if (dcomp_surface_) {
TRACE_EVENT0("gpu", "DirectCompositionChildSurfaceWin::EndDraw");
HRESULT hr = dcomp_surface_->EndDraw();
hr = dcomp_surface_->EndDraw();
if (FAILED(hr)) {
DLOG(ERROR) << "EndDraw failed with error " << std::hex << hr;
return false;
......@@ -155,7 +156,6 @@ bool DirectCompositionChildSurfaceWin::ReleaseDrawTexture(bool will_discard) {
TRACE_EVENT2("gpu", "DirectCompositionChildSurfaceWin::PresentSwapChain",
"interval", interval, "dirty_rect",
force_full_damage_ ? "full_damage" : swap_rect_.ToString());
HRESULT hr;
if (force_full_damage_) {
hr = swap_chain_->Present(interval, flags);
} else {
......@@ -204,9 +204,9 @@ bool DirectCompositionChildSurfaceWin::ReleaseDrawTexture(bool will_discard) {
if (SUCCEEDED(hr)) {
event.Wait();
} else {
device_removed_reason = d3d11_device_->GetDeviceRemovedReason();
base::debug::Alias(&hr);
HRESULT reason = d3d11_device_->GetDeviceRemovedReason();
base::debug::Alias(&reason);
base::debug::Alias(&device_removed_reason);
base::debug::DumpWithoutCrashing();
}
}
......
......@@ -842,10 +842,11 @@ bool SwapChainPresenter::PresentToSwapChain(
return false;
}
HRESULT hr, device_removed_reason;
if (first_present_) {
first_present_ = false;
UINT flags = DXGI_PRESENT_USE_DURATION;
HRESULT hr = swap_chain_->Present(0, flags);
hr = swap_chain_->Present(0, flags);
// Ignore DXGI_STATUS_OCCLUDED since that's not an error but only indicates
// that the window is occluded and we can stop rendering.
if (FAILED(hr) && hr != DXGI_STATUS_OCCLUDED) {
......@@ -882,9 +883,9 @@ bool SwapChainPresenter::PresentToSwapChain(
if (SUCCEEDED(hr)) {
event.Wait();
} else {
device_removed_reason = d3d11_device_->GetDeviceRemovedReason();
base::debug::Alias(&hr);
HRESULT reason = d3d11_device_->GetDeviceRemovedReason();
base::debug::Alias(&reason);
base::debug::Alias(&device_removed_reason);
base::debug::DumpWithoutCrashing();
}
}
......@@ -895,7 +896,7 @@ bool SwapChainPresenter::PresentToSwapChain(
UINT interval = use_swap_chain_tearing ? 0 : 1;
// Ignore DXGI_STATUS_OCCLUDED since that's not an error but only indicates
// that the window is occluded and we can stop rendering.
HRESULT hr = swap_chain_->Present(interval, flags);
hr = swap_chain_->Present(interval, flags);
if (FAILED(hr) && hr != DXGI_STATUS_OCCLUDED) {
DLOG(ERROR) << "Present failed with error 0x" << std::hex << hr;
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment