OLD | NEW |
---|---|
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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 // The request queue should have been processed and does not require a push. | 115 // The request queue should have been processed and does not require a push. |
116 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); | 116 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); |
117 | 117 |
118 if (next_activation_forces_redraw_) { | 118 if (next_activation_forces_redraw_) { |
119 layer_tree_host_impl_->SetFullRootLayerDamage(); | 119 layer_tree_host_impl_->SetFullRootLayerDamage(); |
120 next_activation_forces_redraw_ = false; | 120 next_activation_forces_redraw_ = false; |
121 } | 121 } |
122 | 122 |
123 target_tree->SetLatencyInfo(latency_info_); | 123 target_tree->SetLatencyInfo(latency_info_); |
124 latency_info_.Clear(); | 124 latency_info_.Clear(); |
125 | |
126 target_tree->PassSwapPromises(&swap_promise_list_); | |
127 | |
125 target_tree->SetPageScaleFactorAndLimits( | 128 target_tree->SetPageScaleFactorAndLimits( |
126 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); | 129 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); |
127 target_tree->SetPageScaleDelta( | 130 target_tree->SetPageScaleDelta( |
128 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); | 131 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); |
129 target_tree->set_sent_page_scale_delta(1); | 132 target_tree->set_sent_page_scale_delta(1); |
130 | 133 |
131 if (settings().use_pinch_virtual_viewport) { | 134 if (settings().use_pinch_virtual_viewport) { |
132 target_tree->SetViewportLayersFromIds( | 135 target_tree->SetViewportLayersFromIds( |
133 page_scale_layer_->id(), | 136 page_scale_layer_->id(), |
134 inner_viewport_scroll_layer_->id(), | 137 inner_viewport_scroll_layer_->id(), |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 } | 704 } |
702 | 705 |
703 const ui::LatencyInfo& LayerTreeImpl::GetLatencyInfo() { | 706 const ui::LatencyInfo& LayerTreeImpl::GetLatencyInfo() { |
704 return latency_info_; | 707 return latency_info_; |
705 } | 708 } |
706 | 709 |
707 void LayerTreeImpl::ClearLatencyInfo() { | 710 void LayerTreeImpl::ClearLatencyInfo() { |
708 latency_info_.Clear(); | 711 latency_info_.Clear(); |
709 } | 712 } |
710 | 713 |
714 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | |
715 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
716 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
717 swap_promise_list_.push_back(swap_promise.Pass()); | |
718 } | |
719 | |
720 void LayerTreeImpl::PassSwapPromises( | |
721 ScopedPtrVector<SwapPromise>* new_swap_promise) { | |
722 swap_promise_list_.insert_and_take(swap_promise_list_.end(), | |
723 *new_swap_promise); | |
724 new_swap_promise->clear(); | |
725 } | |
726 | |
727 void LayerTreeImpl::FinishSwapPromises() { | |
728 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
729 DCHECK(swap_promise_list_[i]); | |
danakj
2013/11/26 16:24:37
Same here, move to QueueSwapPromise?
Yufeng Shen (Slow to review)
2013/11/26 17:30:34
Done.
| |
730 swap_promise_list_[i]->DidSwap(); | |
731 } | |
732 swap_promise_list_.clear(); | |
733 } | |
734 | |
735 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | |
736 for (size_t i = 0; i < swap_promise_list_.size(); i++) { | |
737 DCHECK(swap_promise_list_[i]); | |
738 swap_promise_list_[i]->DidNotSwap(reason); | |
739 } | |
740 swap_promise_list_.clear(); | |
741 } | |
742 | |
711 void LayerTreeImpl::DidModifyTilePriorities() { | 743 void LayerTreeImpl::DidModifyTilePriorities() { |
712 layer_tree_host_impl_->DidModifyTilePriorities(); | 744 layer_tree_host_impl_->DidModifyTilePriorities(); |
713 } | 745 } |
714 | 746 |
715 void LayerTreeImpl::set_ui_resource_request_queue( | 747 void LayerTreeImpl::set_ui_resource_request_queue( |
716 const UIResourceRequestQueue& queue) { | 748 const UIResourceRequestQueue& queue) { |
717 ui_resource_request_queue_ = queue; | 749 ui_resource_request_queue_ = queue; |
718 } | 750 } |
719 | 751 |
720 ResourceProvider::ResourceId LayerTreeImpl::ResourceIdForUIResource( | 752 ResourceProvider::ResourceId LayerTreeImpl::ResourceIdForUIResource( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
777 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 809 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
778 const { | 810 const { |
779 // Only the active tree needs to know about layers with copy requests, as | 811 // Only the active tree needs to know about layers with copy requests, as |
780 // they are aborted if not serviced during draw. | 812 // they are aborted if not serviced during draw. |
781 DCHECK(IsActiveTree()); | 813 DCHECK(IsActiveTree()); |
782 | 814 |
783 return layers_with_copy_output_request_; | 815 return layers_with_copy_output_request_; |
784 } | 816 } |
785 | 817 |
786 } // namespace cc | 818 } // namespace cc |
OLD | NEW |