Skip to content

Commit

Permalink
cc: Preserve currently scrolling layer during tree activation
Browse files Browse the repository at this point in the history
BUG=168421


Review URL: https://chromiumcodereview.appspot.com/11826017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175729 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
enne@chromium.org committed Jan 9, 2013
1 parent 9513c15 commit 1e0f8d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cc/layer_tree_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,8 @@ void LayerTreeHostImpl::activatePendingTreeIfNeeded()
void LayerTreeHostImpl::activatePendingTree()
{
CHECK(m_pendingTree);

m_activeTree->PushPersistedState(m_pendingTree.get());
m_activeTree.swap(m_pendingTree);
// TODO(enne): consider recycling this tree to prevent layer churn
m_pendingTree.reset();
Expand Down
6 changes: 6 additions & 0 deletions cc/layer_tree_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
layer_id_map_.erase(layer->id());
}

void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pendingTree) {
int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0;
pendingTree->set_currently_scrolling_layer(
LayerTreeHostCommon::findLayerInSubtree(pendingTree->RootLayer(), id));
}

const LayerTreeSettings& LayerTreeImpl::settings() const {
return layer_tree_host_impl_->settings();
}
Expand Down
4 changes: 3 additions & 1 deletion cc/layer_tree_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class CC_EXPORT LayerTreeImpl {

AnimationRegistrar* animationRegistrar() const;

void PushPersistedState(LayerTreeImpl* pendingTree);

protected:
LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl);

Expand All @@ -144,7 +146,7 @@ class CC_EXPORT LayerTreeImpl {
typedef base::hash_map<int, LayerImpl*> LayerIdMap;
LayerIdMap layer_id_map_;

// Persisted state
// Persisted state for non-impl-side-painting.
int scrolling_layer_id_from_previous_tree_;

// List of visible layers for the most recently prepared frame. Used for
Expand Down

0 comments on commit 1e0f8d6

Please sign in to comment.