Commit 190f7375 authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Chromium LUCI CQ

Add CHECK for consecutive reshape failures

We suspect that in rare cases some clients trigger some kind of loop
failures when Reshape fails, generates context loss, but after
reinitialization it fails again.

This CL adds CHECK for this case to crash and get more info from crash
reports.

Similar logic that was implemented in SkiaOutputDeviceGL earlier in
https://crrev.com/c/2416749

Change-Id: Ifa1dca0ee19423f5ba532644ec45cd373e712b47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626771
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843065}
parent cb8c6e7f
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <vector> #include <vector>
#include "base/command_line.h" #include "base/command_line.h"
#include "base/debug/alias.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/viz/common/switches.h" #include "components/viz/common/switches.h"
...@@ -24,6 +25,21 @@ ...@@ -24,6 +25,21 @@
#include "ui/gfx/swap_result.h" #include "ui/gfx/swap_result.h"
#include "ui/gl/gl_surface.h" #include "ui/gl/gl_surface.h"
namespace {
base::TimeTicks g_last_reshape_failure = base::TimeTicks();
NOINLINE void CheckForLoopFailuresBufferQueue() {
const auto threshold = base::TimeDelta::FromSeconds(1);
auto now = base::TimeTicks::Now();
if (!g_last_reshape_failure.is_null() &&
now - g_last_reshape_failure > threshold) {
CHECK(false);
}
g_last_reshape_failure = now;
}
} // namespace
namespace viz { namespace viz {
class SkiaOutputDeviceBufferQueue::OverlayData { class SkiaOutputDeviceBufferQueue::OverlayData {
...@@ -480,7 +496,10 @@ bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size, ...@@ -480,7 +496,10 @@ bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size,
DCHECK(pending_overlay_mailboxes_.empty()); DCHECK(pending_overlay_mailboxes_.empty());
if (!presenter_->Reshape(size, device_scale_factor, color_space, format, if (!presenter_->Reshape(size, device_scale_factor, color_space, format,
transform)) { transform)) {
DLOG(ERROR) << "Failed to resize."; LOG(ERROR) << "Failed to resize.";
CheckForLoopFailuresBufferQueue();
// To prevent tail call, so we can see the stack.
base::debug::Alias(nullptr);
return false; return false;
} }
...@@ -494,7 +513,13 @@ bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size, ...@@ -494,7 +513,13 @@ bool SkiaOutputDeviceBufferQueue::Reshape(const gfx::Size& size,
background_image_is_scheduled_ = false; background_image_is_scheduled_ = false;
} }
return RecreateImages(); bool success = RecreateImages();
if (!success) {
CheckForLoopFailuresBufferQueue();
// To prevent tail call, so we can see the stack.
base::debug::Alias(nullptr);
}
return success;
} }
bool SkiaOutputDeviceBufferQueue::RecreateImages() { bool SkiaOutputDeviceBufferQueue::RecreateImages() {
......
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