summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/layer_tree_host.cc1
-rw-r--r--cc/layer_tree_host_impl.cc7
-rw-r--r--cc/layer_tree_impl.cc20
-rw-r--r--cc/layer_tree_impl.h7
-rw-r--r--cc/thread_proxy.cc7
5 files changed, 39 insertions, 3 deletions
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 8ce6a29..cddb09b 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -328,6 +328,7 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
if (syncTree->ContentsTexturesPurged())
syncTree->ResetContentsTexturesPurged();
}
+ syncTree->ResetViewportSizeInvalid();
m_commitNumber++;
}
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index e6c0de7..397a2d3 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -234,6 +234,10 @@ bool LayerTreeHostImpl::canDraw()
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport");
return false;
}
+ if (m_activeTree->ViewportSizeInvalid()) {
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw viewport size recently changed");
+ return false;
+ }
if (!m_renderer) {
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer");
return false;
@@ -1102,6 +1106,9 @@ void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, con
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
return;
+ if (pendingTree() && m_deviceViewportSize != deviceViewportSize)
+ activeTree()->SetViewportSizeInvalid();
+
m_layoutViewportSize = layoutViewportSize;
m_deviceViewportSize = deviceViewportSize;
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index 832ecaa..b0d071e 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -27,6 +27,7 @@ LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl)
max_page_scale_factor_(0),
scrolling_layer_id_from_previous_tree_(0),
contents_textures_purged_(false),
+ viewport_size_invalid_(false),
needs_update_draw_properties_(true),
needs_full_tree_sync_(true) {
}
@@ -104,6 +105,11 @@ void LayerTreeImpl::pushPropertiesTo(LayerTreeImpl* target_tree) {
else
target_tree->ResetContentsTexturesPurged();
+ if (ViewportSizeInvalid())
+ target_tree->SetViewportSizeInvalid();
+ else
+ target_tree->ResetViewportSizeInvalid();
+
if (hud_layer())
target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(
LayerTreeHostCommon::findLayerInSubtree(
@@ -346,6 +352,20 @@ void LayerTreeImpl::ResetContentsTexturesPurged() {
layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
}
+bool LayerTreeImpl::ViewportSizeInvalid() const {
+ return viewport_size_invalid_;
+}
+
+void LayerTreeImpl::SetViewportSizeInvalid() {
+ viewport_size_invalid_ = true;
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+}
+
+void LayerTreeImpl::ResetViewportSizeInvalid() {
+ viewport_size_invalid_ = false;
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+}
+
Proxy* LayerTreeImpl::proxy() const {
return layer_tree_host_impl_->proxy();
}
diff --git a/cc/layer_tree_impl.h b/cc/layer_tree_impl.h
index 092027e..729c3d45 100644
--- a/cc/layer_tree_impl.h
+++ b/cc/layer_tree_impl.h
@@ -179,6 +179,12 @@ class CC_EXPORT LayerTreeImpl {
void SetContentsTexturesPurged();
void ResetContentsTexturesPurged();
+ // Set on the active tree when the viewport size recently changed
+ // and the active tree's size is now out of date.
+ bool ViewportSizeInvalid() const;
+ void SetViewportSizeInvalid();
+ void ResetViewportSizeInvalid();
+
// Useful for debug assertions, probably shouldn't be used for anything else.
Proxy* proxy() const;
@@ -211,6 +217,7 @@ protected:
LayerList render_surface_layer_list_;
bool contents_textures_purged_;
+ bool viewport_size_invalid_;
bool needs_update_draw_properties_;
// In impl-side painting mode, this is true when the tree may contain
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index 9e7773c..ddc61c0 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -1176,9 +1176,10 @@ void ThreadProxy::renewTreePriority()
if (m_smoothnessTakesPriorityExpirationTime > base::TimeTicks::Now())
priority = SMOOTHNESS_TAKES_PRIORITY;
- // New content always takes priority when we have an active tree with
- // evicted resources.
- if (m_layerTreeHostImpl->activeTree()->ContentsTexturesPurged())
+ // New content always takes priority when the active tree has
+ // evicted resources or there is an invalid viewport size.
+ if (m_layerTreeHostImpl->activeTree()->ContentsTexturesPurged() ||
+ m_layerTreeHostImpl->activeTree()->ViewportSizeInvalid())
priority = NEW_CONTENT_TAKES_PRIORITY;
m_layerTreeHostImpl->setTreePriority(priority);