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

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

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