| Index: components/display_compositor/buffer_queue.cc
|
| diff --git a/components/display_compositor/buffer_queue.cc b/components/display_compositor/buffer_queue.cc
|
| index afb40e1a4912accfc68929b8d7b72d70e7ac8cb8..60b50d7a8bbab3979758bcc60b78e77488d1bf76 100644
|
| --- a/components/display_compositor/buffer_queue.cc
|
| +++ b/components/display_compositor/buffer_queue.cc
|
| @@ -183,13 +183,32 @@ std::unique_ptr<BufferQueue::AllocatedSurface> BufferQueue::RecreateBuffer(
|
| }
|
|
|
| void BufferQueue::PageFlipComplete() {
|
| - DCHECK(!in_flight_surfaces_.empty());
|
| + // Early out when no surface is in-flight. This can happen when using
|
| + // overlays and page flipping without changing the primary plane.
|
| + if (in_flight_surfaces_.empty())
|
| + return;
|
| if (displayed_surface_)
|
| available_surfaces_.push_back(std::move(displayed_surface_));
|
| displayed_surface_ = std::move(in_flight_surfaces_.front());
|
| in_flight_surfaces_.pop_front();
|
| }
|
|
|
| +uint32_t BufferQueue::GetCurrentTextureId() const {
|
| + // Return current surface texture if bound.
|
| + if (current_surface_)
|
| + return current_surface_->texture;
|
| +
|
| + // Return in-flight or displayed surface texture if no surface is
|
| + // currently bound. This can happen when using overlays and surface
|
| + // damage is empty.
|
| + if (!in_flight_surfaces_.empty())
|
| + return in_flight_surfaces_.back()->texture;
|
| + if (displayed_surface_)
|
| + return displayed_surface_->texture;
|
| +
|
| + return 0;
|
| +}
|
| +
|
| void BufferQueue::FreeAllSurfaces() {
|
| displayed_surface_.reset();
|
| current_surface_.reset();
|
|
|