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

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: Implement test helpers. 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
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/layer_scroll_offset_delegate.h" 23 #include "cc/input/layer_scroll_offset_delegate.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 694
694 gfx::Size LayerTreeImpl::ScrollableSize() const { 695 gfx::Size LayerTreeImpl::ScrollableSize() const {
695 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() 696 LayerImpl* root_scroll_layer = OuterViewportScrollLayer()
696 ? OuterViewportScrollLayer() 697 ? OuterViewportScrollLayer()
697 : InnerViewportScrollLayer(); 698 : InnerViewportScrollLayer();
698 if (!root_scroll_layer || root_scroll_layer->children().empty()) 699 if (!root_scroll_layer || root_scroll_layer->children().empty())
699 return gfx::Size(); 700 return gfx::Size();
700 return root_scroll_layer->children()[0]->bounds(); 701 return root_scroll_layer->children()[0]->bounds();
701 } 702 }
702 703
703 LayerImpl* LayerTreeImpl::LayerById(int id) { 704 LayerImpl* LayerTreeImpl::LayerById(int id) const {
704 LayerIdMap::iterator iter = layer_id_map_.find(id); 705 LayerIdMap::const_iterator iter = layer_id_map_.find(id);
705 return iter != layer_id_map_.end() ? iter->second : NULL; 706 return iter != layer_id_map_.end() ? iter->second : NULL;
706 } 707 }
707 708
708 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { 709 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) {
709 DCHECK(!LayerById(layer->id())); 710 DCHECK(!LayerById(layer->id()));
710 layer_id_map_[layer->id()] = layer; 711 layer_id_map_[layer->id()] = layer;
712 if (layer_tree_host_impl_->animation_host())
713 layer_tree_host_impl_->animation_host()->RegisterLayer(layer->id(),
714 IsActiveTree());
711 } 715 }
712 716
713 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { 717 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
714 DCHECK(LayerById(layer->id())); 718 DCHECK(LayerById(layer->id()));
719 if (layer_tree_host_impl_->animation_host())
720 layer_tree_host_impl_->animation_host()->UnregisterLayer(layer->id(),
721 IsActiveTree());
715 layer_id_map_.erase(layer->id()); 722 layer_id_map_.erase(layer->id());
716 } 723 }
717 724
718 size_t LayerTreeImpl::NumLayers() { 725 size_t LayerTreeImpl::NumLayers() {
719 return layer_id_map_.size(); 726 return layer_id_map_.size();
720 } 727 }
721 728
722 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) { 729 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pending_tree) {
723 pending_tree->SetCurrentlyScrollingLayer( 730 pending_tree->SetCurrentlyScrollingLayer(
724 LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(), 731 LayerTreeHostCommon::FindLayerInSubtree(pending_tree->root_layer(),
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 scoped_ptr<PendingPageScaleAnimation> pending_animation) { 1570 scoped_ptr<PendingPageScaleAnimation> pending_animation) {
1564 pending_page_scale_animation_ = pending_animation.Pass(); 1571 pending_page_scale_animation_ = pending_animation.Pass();
1565 } 1572 }
1566 1573
1567 scoped_ptr<PendingPageScaleAnimation> 1574 scoped_ptr<PendingPageScaleAnimation>
1568 LayerTreeImpl::TakePendingPageScaleAnimation() { 1575 LayerTreeImpl::TakePendingPageScaleAnimation() {
1569 return pending_page_scale_animation_.Pass(); 1576 return pending_page_scale_animation_.Pass();
1570 } 1577 }
1571 1578
1572 } // namespace cc 1579 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698