Fix frozen OSR rendering after resize (fixes issue #2627)

This commit is contained in:
Riku Palomäki
2019-03-18 21:04:21 +00:00
committed by Marshall Greenblatt
parent 64ad8c32f2
commit 531df6eaba
2 changed files with 13 additions and 5 deletions

View File

@@ -344,6 +344,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
software_output_device_(NULL), software_output_device_(NULL),
hold_resize_(false), hold_resize_(false),
pending_resize_(false), pending_resize_(false),
pending_resize_force_(false),
render_widget_host_(content::RenderWidgetHostImpl::From(widget)), render_widget_host_(content::RenderWidgetHostImpl::From(widget)),
has_parent_(parent_host_view != NULL), has_parent_(parent_host_view != NULL),
parent_host_view_(parent_host_view), parent_host_view_(parent_host_view),
@@ -1142,9 +1143,11 @@ CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() {
viz::ScopedSurfaceIdAllocator viz::ScopedSurfaceIdAllocator
CefRenderWidgetHostViewOSR::DidUpdateVisualProperties( CefRenderWidgetHostViewOSR::DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) { const cc::RenderFrameMetadata& metadata) {
bool force =
local_surface_id_allocation_ != metadata.local_surface_id_allocation;
base::OnceCallback<void()> allocation_task = base::OnceCallback<void()> allocation_task =
base::BindOnce(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties, base::BindOnce(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties,
weak_ptr_factory_.GetWeakPtr()); weak_ptr_factory_.GetWeakPtr(), force);
return viz::ScopedSurfaceIdAllocator(std::move(allocation_task)); return viz::ScopedSurfaceIdAllocator(std::move(allocation_task));
} }
#endif #endif
@@ -1249,14 +1252,16 @@ bool CefRenderWidgetHostViewOSR::InstallTransparency() {
return false; return false;
} }
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties() { void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties(bool force) {
if (hold_resize_) { if (hold_resize_) {
if (!pending_resize_) if (!pending_resize_)
pending_resize_ = true; pending_resize_ = true;
if (force)
pending_resize_force_ = true;
return; return;
} }
ResizeRootLayer(false); ResizeRootLayer(force);
} }
void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() { void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
@@ -1637,11 +1642,13 @@ void CefRenderWidgetHostViewOSR::ReleaseResize() {
hold_resize_ = false; hold_resize_ = false;
if (pending_resize_) { if (pending_resize_) {
bool force = pending_resize_force_;
pending_resize_ = false; pending_resize_ = false;
pending_resize_force_ = false;
CEF_POST_TASK( CEF_POST_TASK(
CEF_UIT, CEF_UIT,
base::Bind(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties, base::Bind(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr(), force));
} }
} }

View File

@@ -225,7 +225,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
bool InstallTransparency(); bool InstallTransparency();
void SynchronizeVisualProperties(); void SynchronizeVisualProperties(bool force = false);
void OnScreenInfoChanged(); void OnScreenInfoChanged();
void Invalidate(CefBrowserHost::PaintElementType type); void Invalidate(CefBrowserHost::PaintElementType type);
void SendExternalBeginFrame(); void SendExternalBeginFrame();
@@ -395,6 +395,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
bool hold_resize_; bool hold_resize_;
bool pending_resize_; bool pending_resize_;
bool pending_resize_force_;
// The associated Model. While |this| is being Destroyed, // The associated Model. While |this| is being Destroyed,
// |render_widget_host_| is NULL and the message loop is run one last time // |render_widget_host_| is NULL and the message loop is run one last time