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 std::vector<scoped_ptr<SwapPromise>>::iterator it = |
818 info->swap_promises.begin(); | |
818 for (; it != info->swap_promises.end(); ++it) { | 819 for (; it != info->swap_promises.end(); ++it) { |
danakj
2015/11/17 01:12:18
hm.. why isn't this range-based?
vmpstr
2015/11/17 23:26:25
Hmm. I'm not sure. I changed it...
| |
819 scoped_ptr<SwapPromise> swap_promise(info->swap_promises.take(it)); | 820 scoped_ptr<SwapPromise> swap_promise(it->Pass()); |
820 TRACE_EVENT_WITH_FLOW1("input,benchmark", | 821 TRACE_EVENT_WITH_FLOW1("input,benchmark", |
821 "LatencyInfo.Flow", | 822 "LatencyInfo.Flow", |
822 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 823 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
823 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 824 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
824 "step", "Main thread scroll update"); | 825 "step", "Main thread scroll update"); |
825 QueueSwapPromise(swap_promise.Pass()); | 826 QueueSwapPromise(swap_promise.Pass()); |
826 } | 827 } |
827 | 828 |
828 gfx::Vector2dF inner_viewport_scroll_delta; | 829 gfx::Vector2dF inner_viewport_scroll_delta; |
829 gfx::Vector2dF outer_viewport_scroll_delta; | 830 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++) | 1024 for (; it != swap_promise_monitor_.end(); it++) |
1024 (*it)->OnSetNeedsCommitOnMain(); | 1025 (*it)->OnSetNeedsCommitOnMain(); |
1025 } | 1026 } |
1026 | 1027 |
1027 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 1028 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
1028 DCHECK(swap_promise); | 1029 DCHECK(swap_promise); |
1029 swap_promise_list_.push_back(swap_promise.Pass()); | 1030 swap_promise_list_.push_back(swap_promise.Pass()); |
1030 } | 1031 } |
1031 | 1032 |
1032 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1033 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1033 for (auto* swap_promise : swap_promise_list_) | 1034 for (const scoped_ptr<SwapPromise>& swap_promise : swap_promise_list_) |
danakj
2015/11/17 01:12:18
auto
vmpstr
2015/11/17 23:26:25
Done.
| |
1034 swap_promise->DidNotSwap(reason); | 1035 swap_promise->DidNotSwap(reason); |
1035 swap_promise_list_.clear(); | 1036 swap_promise_list_.clear(); |
1036 } | 1037 } |
1037 | 1038 |
1038 void LayerTreeHost::OnCommitForSwapPromises() { | 1039 void LayerTreeHost::OnCommitForSwapPromises() { |
1039 for (auto* swap_promise : swap_promise_list_) | 1040 for (const scoped_ptr<SwapPromise>& swap_promise : swap_promise_list_) |
danakj
2015/11/17 01:12:18
auto
vmpstr
2015/11/17 23:26:25
Done.
| |
1040 swap_promise->OnCommit(); | 1041 swap_promise->OnCommit(); |
1041 } | 1042 } |
1042 | 1043 |
1043 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1044 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { |
1044 surface_id_namespace_ = id_namespace; | 1045 surface_id_namespace_ = id_namespace; |
1045 } | 1046 } |
1046 | 1047 |
1047 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1048 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
1048 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1049 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); |
1049 } | 1050 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1246 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1247 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1247 : false; | 1248 : false; |
1248 } | 1249 } |
1249 | 1250 |
1250 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1251 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1251 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1252 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1252 : false; | 1253 : false; |
1253 } | 1254 } |
1254 | 1255 |
1255 } // namespace cc | 1256 } // namespace cc |
OLD | NEW |