Commit c820517f authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Ensure an empty frame's size is non zero

This is a speculative fix for crbug.com/1041932

Bug: 1041932
Change-Id: I0dfe7479967729dc242f32eba4772107fcc3f7ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2093073
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748568}
parent 6b86f582
...@@ -232,7 +232,7 @@ void SurfaceTreeHost::SubmitCompositorFrame() { ...@@ -232,7 +232,7 @@ void SurfaceTreeHost::SubmitCompositorFrame() {
const std::string* app_id = GetShellApplicationId(toplevel); const std::string* app_id = GetShellApplicationId(toplevel);
const std::string* startup_id = GetShellStartupId(toplevel); const std::string* startup_id = GetShellStartupId(toplevel);
auto* shell_surface = GetShellSurfaceBaseForWindow(toplevel); auto* shell_surface = GetShellSurfaceBaseForWindow(toplevel);
DCHECK(!frame.size_in_pixels().IsEmpty()) CHECK(!frame.size_in_pixels().IsEmpty())
<< " Title=" << shell_surface->GetWindowTitle() << " Title=" << shell_surface->GetWindowTitle()
<< ", AppType=" << static_cast<int>(app_type) << ", AppType=" << static_cast<int>(app_type)
<< ", AppId=" << (app_id ? *app_id : "''") << ", AppId=" << (app_id ? *app_id : "''")
...@@ -339,8 +339,13 @@ viz::CompositorFrame SurfaceTreeHost::PrepareToSubmitCompositorFrame() { ...@@ -339,8 +339,13 @@ viz::CompositorFrame SurfaceTreeHost::PrepareToSubmitCompositorFrame() {
// because the size is different. // because the size is different.
const float device_scale_factor = const float device_scale_factor =
host_window()->layer()->device_scale_factor(); host_window()->layer()->device_scale_factor();
const gfx::Size output_surface_size_in_pixels = gfx::ConvertSizeToPixel( gfx::Size output_surface_size_in_pixels = gfx::ConvertSizeToPixel(
device_scale_factor, host_window_->bounds().size()); device_scale_factor, host_window_->bounds().size());
// Viz will crash if the frame size is empty. Ensure it's not empty.
// crbug.com/1041932.
if (output_surface_size_in_pixels.IsEmpty())
output_surface_size_in_pixels.SetSize(1, 1);
render_pass->SetNew(kRenderPassId, gfx::Rect(output_surface_size_in_pixels), render_pass->SetNew(kRenderPassId, gfx::Rect(output_surface_size_in_pixels),
gfx::Rect(), gfx::Transform()); gfx::Rect(), gfx::Transform());
frame.metadata.device_scale_factor = device_scale_factor; frame.metadata.device_scale_factor = device_scale_factor;
......
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