Index: ui/gl/gl_surface_ozone.cc |
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc |
index 978c982315a611baf1cb7daac2851431bae80082..a75680c9ffae0a68cb96cd27d7ec19e952292730 100644 |
--- a/ui/gl/gl_surface_ozone.cc |
+++ b/ui/gl/gl_surface_ozone.cc |
@@ -388,9 +388,14 @@ void GLSurfaceOzoneSurfaceless::SubmitFrame() { |
unsubmitted_frames_.weak_erase(unsubmitted_frames_.begin()); |
swap_buffers_pending_ = true; |
- last_swap_buffers_result_ = |
- frame->ScheduleOverlayPlanes(widget_) && |
- ozone_surface_->OnSwapBuffersAsync(frame->callback); |
+ if (!frame->ScheduleOverlayPlanes(widget_)) { |
+ // |callback| is a wrapper for SwapCompleted(). Call it to properly |
+ // propagate the failed state. |
+ frame->callback.Run(gfx::SwapResult::SWAP_FAILED); |
+ return; |
+ } |
+ |
+ ozone_surface_->OnSwapBuffersAsync(frame->callback); |
} |
} |
@@ -413,6 +418,10 @@ void GLSurfaceOzoneSurfaceless::SwapCompleted( |
gfx::SwapResult result) { |
callback.Run(result); |
swap_buffers_pending_ = false; |
+ if (result == gfx::SwapResult::SWAP_FAILED) { |
+ last_swap_buffers_result_ = false; |
+ return; |
+ } |
SubmitFrame(); |
} |