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_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 bool did_paint_content = false; | 807 bool did_paint_content = false; |
808 for (const auto& layer : update_layer_list) { | 808 for (const auto& layer : update_layer_list) { |
809 did_paint_content |= layer->Update(); | 809 did_paint_content |= layer->Update(); |
810 content_is_suitable_for_gpu_rasterization_ &= | 810 content_is_suitable_for_gpu_rasterization_ &= |
811 layer->IsSuitableForGpuRasterization(); | 811 layer->IsSuitableForGpuRasterization(); |
812 } | 812 } |
813 return did_paint_content; | 813 return did_paint_content; |
814 } | 814 } |
815 | 815 |
816 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 816 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
817 ScopedPtrVector<SwapPromise>::iterator it = info->swap_promises.begin(); | 817 for (auto& swap_promise : info->swap_promises) { |
818 for (; it != info->swap_promises.end(); ++it) { | |
819 scoped_ptr<SwapPromise> swap_promise(info->swap_promises.take(it)); | |
820 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 818 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
821 "LatencyInfo.Flow", | 819 "LatencyInfo.Flow", |
822 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 820 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
823 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 821 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
824 "step", "Main thread scroll update"); | 822 "step", "Main thread scroll update"); |
825 QueueSwapPromise(swap_promise.Pass()); | 823 QueueSwapPromise(swap_promise.Pass()); |
826 } | 824 } |
827 | 825 |
828 gfx::Vector2dF inner_viewport_scroll_delta; | 826 gfx::Vector2dF inner_viewport_scroll_delta; |
829 gfx::Vector2dF outer_viewport_scroll_delta; | 827 gfx::Vector2dF outer_viewport_scroll_delta; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 for (; it != swap_promise_monitor_.end(); it++) | 1021 for (; it != swap_promise_monitor_.end(); it++) |
1024 (*it)->OnSetNeedsCommitOnMain(); | 1022 (*it)->OnSetNeedsCommitOnMain(); |
1025 } | 1023 } |
1026 | 1024 |
1027 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1025 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
1028 DCHECK(swap_promise); | 1026 DCHECK(swap_promise); |
1029 swap_promise_list_.push_back(swap_promise.Pass()); | 1027 swap_promise_list_.push_back(swap_promise.Pass()); |
1030 } | 1028 } |
1031 | 1029 |
1032 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1030 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1033 for (auto* swap_promise : swap_promise_list_) | 1031 for (const auto& swap_promise : swap_promise_list_) |
1034 swap_promise->DidNotSwap(reason); | 1032 swap_promise->DidNotSwap(reason); |
1035 swap_promise_list_.clear(); | 1033 swap_promise_list_.clear(); |
1036 } | 1034 } |
1037 | 1035 |
1038 void LayerTreeHost::OnCommitForSwapPromises() { | 1036 void LayerTreeHost::OnCommitForSwapPromises() { |
1039 for (auto* swap_promise : swap_promise_list_) | 1037 for (const auto& swap_promise : swap_promise_list_) |
1040 swap_promise->OnCommit(); | 1038 swap_promise->OnCommit(); |
1041 } | 1039 } |
1042 | 1040 |
1043 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1041 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { |
1044 surface_id_namespace_ = id_namespace; | 1042 surface_id_namespace_ = id_namespace; |
1045 } | 1043 } |
1046 | 1044 |
1047 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1045 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
1048 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1046 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); |
1049 } | 1047 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1244 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1247 : false; | 1245 : false; |
1248 } | 1246 } |
1249 | 1247 |
1250 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1248 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1251 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1249 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1252 : false; | 1250 : false; |
1253 } | 1251 } |
1254 | 1252 |
1255 } // namespace cc | 1253 } // namespace cc |
OLD | NEW |