summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-09-19 16:49:30 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-09-22 08:47:32 +0000
commit43b7af20c421e4ffb20cd4625f3b704e78e7325d (patch)
treec12f9d415e44e9413dc2341c73b85a78fc243b60 /src/core/render_widget_host_view_qt.cpp
parent75fcb640fae72446b26d7978a5df3c058e0ab67f (diff)
Handle Chromium resize throttling using surface ids
We need to change surface id to acknowledge a resize is completed, and we need to handle that Chromium is rejecting resize events because the last one is not yet acknowledged. Change-Id: I93b1e197218906de80d5748a5a100f7a740ea07c Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 737f42439..b03be1313 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -332,6 +332,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
, m_cursorPosition(0)
, m_emptyPreviousSelection(true)
, m_wheelAckPending(false)
+ , m_pendingResize(false)
, m_mouseWheelPhaseHandler(this)
{
host()->SetView(this);
@@ -348,6 +349,8 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
const QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext();
m_imeHasHiddenTextCapability = context && context->hasCapability(QPlatformInputContext::HiddenTextCapability);
+
+ m_localSurfaceId = m_localSurfaceIdAllocator.GenerateId();
}
RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
@@ -734,11 +737,6 @@ void RenderWidgetHostViewQt::SubmitCompositorFrame(const viz::LocalSurfaceId &lo
bool contentsSizeChanged = (m_lastContentsSize != frame.metadata.root_layer_size);
m_lastScrollOffset = frame.metadata.root_scroll_offset;
m_lastContentsSize = frame.metadata.root_layer_size;
- if (m_localSurfaceId != local_surface_id) {
- m_localSurfaceId = local_surface_id;
- // FIXME: update frame_size and device_scale_factor?
- // FIXME: showPrimarySurface()?
- }
// Force to process swap messages
uint32_t frame_token = frame.metadata.frame_token;
@@ -940,15 +938,41 @@ void RenderWidgetHostViewQt::OnGestureEvent(const ui::GestureEventData& gesture)
host()->ForwardGestureEvent(ui::CreateWebGestureEventFromGestureEventData(gesture));
}
+viz::ScopedSurfaceIdAllocator RenderWidgetHostViewQt::DidUpdateVisualProperties(const cc::RenderFrameMetadata &metadata)
+{
+ base::OnceCallback<void()> allocation_task =
+ base::BindOnce(&RenderWidgetHostViewQt::OnDidUpdateVisualPropertiesComplete,
+ base::Unretained(this), metadata);
+ return viz::ScopedSurfaceIdAllocator(std::move(allocation_task));
+}
+
+void RenderWidgetHostViewQt::OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata)
+{
+ if (metadata.local_surface_id)
+ m_localSurfaceIdAllocator.UpdateFromChild(*metadata.local_surface_id);
+
+ m_localSurfaceId = m_localSurfaceIdAllocator.GenerateId();
+ host()->SendScreenRects();
+ if (m_pendingResize) {
+ if (host()->SynchronizeVisualProperties())
+ m_pendingResize = false;
+ }
+}
+
QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode)
{
+ if (m_pendingResize && host()) {
+ if (host()->SynchronizeVisualProperties())
+ m_pendingResize = false;
+ }
return m_compositor->updatePaintNode(oldNode);
}
void RenderWidgetHostViewQt::notifyResize()
{
- host()->SynchronizeVisualProperties();
- host()->SendScreenRects();
+ m_pendingResize = true;
+ if (host()->SynchronizeVisualProperties())
+ m_pendingResize = false;
}
void RenderWidgetHostViewQt::notifyShown()