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

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 947033002: CC Animations: Establish AnimationHost, AnimationTimeline and AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set up impl-only timelines for ScrollOffset animations Created 5 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | cc/trees/layer_tree_mutators_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "base/trace_event/trace_event_argument.h" 12 #include "base/trace_event/trace_event_argument.h"
13 #include "cc/animation/animation_host.h"
13 #include "cc/animation/keyframed_animation_curve.h" 14 #include "cc/animation/keyframed_animation_curve.h"
14 #include "cc/animation/scrollbar_animation_controller.h" 15 #include "cc/animation/scrollbar_animation_controller.h"
15 #include "cc/animation/scrollbar_animation_controller_linear_fade.h" 16 #include "cc/animation/scrollbar_animation_controller_linear_fade.h"
16 #include "cc/animation/scrollbar_animation_controller_thinning.h" 17 #include "cc/animation/scrollbar_animation_controller_thinning.h"
17 #include "cc/base/math_util.h" 18 #include "cc/base/math_util.h"
18 #include "cc/base/synced_property.h" 19 #include "cc/base/synced_property.h"
19 #include "cc/base/util.h" 20 #include "cc/base/util.h"
20 #include "cc/debug/devtools_instrumentation.h" 21 #include "cc/debug/devtools_instrumentation.h"
21 #include "cc/debug/traced_value.h" 22 #include "cc/debug/traced_value.h"
22 #include "cc/input/page_scale_animation.h" 23 #include "cc/input/page_scale_animation.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 720
720 gfx::Size LayerTreeImpl::ScrollableSize() const { 721 gfx::Size LayerTreeImpl::ScrollableSize() const {
721 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() 722 LayerImpl* root_scroll_layer = OuterViewportScrollLayer()
722 ? OuterViewportScrollLayer() 723 ? OuterViewportScrollLayer()
723 : InnerViewportScrollLayer(); 724 : InnerViewportScrollLayer();
724 if (!root_scroll_layer || root_scroll_layer->children().empty()) 725 if (!root_scroll_layer || root_scroll_layer->children().empty())
725 return gfx::Size(); 726 return gfx::Size();
726 return root_scroll_layer->children()[0]->bounds(); 727 return root_scroll_layer->children()[0]->bounds();
727 } 728 }
728 729
729 LayerImpl* LayerTreeImpl::LayerById(int id) { 730 LayerImpl* LayerTreeImpl::LayerById(int id) const {
730 LayerIdMap::iterator iter = layer_id_map_.find(id); 731 LayerIdMap::const_iterator iter = layer_id_map_.find(id);
731 return iter != layer_id_map_.end() ? iter->second : NULL; 732 return iter != layer_id_map_.end() ? iter->second : NULL;
732 } 733 }
733 734
734 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { 735 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) {
735 DCHECK(!LayerById(layer->id())); 736 DCHECK(!LayerById(layer->id()));
736 layer_id_map_[layer->id()] = layer; 737 layer_id_map_[layer->id()] = layer;
738 if (layer_tree_host_impl_->animation_host())
739 layer_tree_host_impl_->animation_host()->RegisterLayerImpl(layer->id(),
740 IsActiveTree());
737 } 741 }
738 742
739 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { 743 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
740 DCHECK(LayerById(layer->id())); 744 DCHECK(LayerById(layer->id()));
745 if (layer_tree_host_impl_->animation_host())
746 layer_tree_host_impl_->animation_host()->UnregisterLayerImpl(
747 layer->id(), IsActiveTree());
741 layer_id_map_.erase(layer->id()); 748 layer_id_map_.erase(layer->id());
742 } 749 }
743 750
744 size_t LayerTreeImpl::NumLayers() { 751 size_t LayerTreeImpl::NumLayers() {
745 return layer_id_map_.size(); 752 return layer_id_map_.size();
746 } 753 }
747 754
748 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) { 755 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) {
749 pending_tree->SetCurrentlyScrollingLayer( 756 pending_tree->SetCurrentlyScrollingLayer(
750 LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(), 757 LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(),
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 scoped_ptr<PendingPageScaleAnimation> pending_animation) { 1645 scoped_ptr<PendingPageScaleAnimation> pending_animation) {
1639 pending_page_scale_animation_ = pending_animation.Pass(); 1646 pending_page_scale_animation_ = pending_animation.Pass();
1640 } 1647 }
1641 1648
1642 scoped_ptr<PendingPageScaleAnimation> 1649 scoped_ptr<PendingPageScaleAnimation>
1643 LayerTreeImpl::TakePendingPageScaleAnimation() { 1650 LayerTreeImpl::TakePendingPageScaleAnimation() {
1644 return pending_page_scale_animation_.Pass(); 1651 return pending_page_scale_animation_.Pass();
1645 } 1652 }
1646 1653
1647 } // namespace cc 1654 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | cc/trees/layer_tree_mutators_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698