Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Unified Diff: cc/layer_tree_host.cc

Issue 11316297: Only do full tree sync if tree is actually changed, otherwise just push properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extra newline Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cc/layer.cc ('K') | « cc/layer_tree_host.h ('k') | cc/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host.cc
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index ed393fbfa3ea35bcf2cd4e8cdcb539cf31cc9033..d3232df934bb945b178636e9e879e0701944449f 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -160,6 +160,7 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con
LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings)
: m_animating(false)
, m_needsAnimateLayers(false)
+ , m_needsFullTreeSync(true)
, m_client(client)
, m_commitNumber(0)
, m_renderingStats()
@@ -309,6 +310,28 @@ void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl)
TRACE_EVENT0("cc", "LayerTreeHost::commitTo");
}
+static void pushPropertiesRecursive(Layer* layer, LayerImpl* layerImpl)
+{
+ if (!layer) {
+ DCHECK(!layerImpl);
+ return;
+ }
+
+ DCHECK_EQ(layer->id(), layerImpl->id());
+ layer->pushPropertiesTo(layerImpl);
+
+ pushPropertiesRecursive(layer->maskLayer(), layerImpl->maskLayer());
+ pushPropertiesRecursive(layer->replicaLayer(), layerImpl->replicaLayer());
+
+ const std::vector<scoped_refptr<Layer> >& children = layer->children();
+ const ScopedPtrVector<LayerImpl>& implChildren = layerImpl->children();
+ DCHECK_EQ(children.size(), implChildren.size());
danakj 2012/12/03 18:46:25 should it CRASH() in this case? We could end up pa
+
+ for (size_t i = 0; i < children.size(); ++i) {
+ pushPropertiesRecursive(children[i].get(), implChildren[i]);
+ }
+}
+
// This function commits the LayerTreeHost to an impl tree. When modifying
// this function, keep in mind that the function *runs* on the impl thread! Any
// code that is logically a main thread operation, e.g. deletion of a Layer,
@@ -321,7 +344,13 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
m_contentsTextureManager->updateBackingsInDrawingImplTree();
m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider());
- hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->detachLayerTree(), hostImpl));
+ if (m_needsFullTreeSync) {
+ hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->detachLayerTree(), hostImpl));
+ } else {
+ TRACE_EVENT0("cc", "LayerTreeHost::pushPropertiesRecursive");
+ pushPropertiesRecursive(rootLayer(), hostImpl->rootLayer());
+ }
+ m_needsFullTreeSync = false;
if (m_rootLayer && m_hudLayer)
hostImpl->setHudLayer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHostCommon::findLayerInSubtree(hostImpl->rootLayer(), m_hudLayer->id())));
@@ -442,6 +471,12 @@ void LayerTreeHost::setNeedsCommit()
m_proxy->setNeedsCommit();
}
+void LayerTreeHost::setNeedsFullTreeSync()
+{
+ m_needsFullTreeSync = true;
+ setNeedsCommit();
+}
+
void LayerTreeHost::setNeedsRedraw()
{
m_proxy->setNeedsRedraw();
@@ -480,7 +515,7 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
if (m_hudLayer)
m_hudLayer->removeFromParent();
- setNeedsCommit();
+ setNeedsFullTreeSync();
}
void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState)
« cc/layer.cc ('K') | « cc/layer_tree_host.h ('k') | cc/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698