OLD | NEW |
---|---|
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 transform_is_invertible_(true), | 72 transform_is_invertible_(true), |
73 has_render_surface_(false), | 73 has_render_surface_(false), |
74 clear_impl_scroll_delta_(false), | 74 clear_impl_scroll_delta_(false), |
75 background_color_(0), | 75 background_color_(0), |
76 opacity_(1.f), | 76 opacity_(1.f), |
77 blend_mode_(SkXfermode::kSrcOver_Mode), | 77 blend_mode_(SkXfermode::kSrcOver_Mode), |
78 scroll_parent_(nullptr), | 78 scroll_parent_(nullptr), |
79 clip_parent_(nullptr), | 79 clip_parent_(nullptr), |
80 replica_layer_(nullptr), | 80 replica_layer_(nullptr), |
81 raster_scale_(0.f), | 81 raster_scale_(0.f), |
82 client_(nullptr) { | 82 client_(nullptr), |
83 frame_timing_requests_dirty_(false) { | |
83 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); | 84 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
84 layer_animation_controller_->AddValueObserver(this); | 85 layer_animation_controller_->AddValueObserver(this); |
85 layer_animation_controller_->set_value_provider(this); | 86 layer_animation_controller_->set_value_provider(this); |
86 } | 87 } |
87 | 88 |
88 Layer::~Layer() { | 89 Layer::~Layer() { |
89 // Our parent should be holding a reference to us so there should be no | 90 // Our parent should be holding a reference to us so there should be no |
90 // way for us to be destroyed while we still have a parent. | 91 // way for us to be destroyed while we still have a parent. |
91 DCHECK(!parent()); | 92 DCHECK(!parent()); |
92 // Similarly we shouldn't have a layer tree host since it also keeps a | 93 // Similarly we shouldn't have a layer tree host since it also keeps a |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1009 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 1010 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
1010 // union) any update changes that have occurred on the main thread. | 1011 // union) any update changes that have occurred on the main thread. |
1011 update_rect_.Union(layer->update_rect()); | 1012 update_rect_.Union(layer->update_rect()); |
1012 layer->SetUpdateRect(update_rect_); | 1013 layer->SetUpdateRect(update_rect_); |
1013 | 1014 |
1014 layer->SetStackingOrderChanged(stacking_order_changed_); | 1015 layer->SetStackingOrderChanged(stacking_order_changed_); |
1015 | 1016 |
1016 layer_animation_controller_->PushAnimationUpdatesTo( | 1017 layer_animation_controller_->PushAnimationUpdatesTo( |
1017 layer->layer_animation_controller()); | 1018 layer->layer_animation_controller()); |
1018 | 1019 |
1020 if (frame_timing_requests_dirty_) { | |
danakj
2015/01/23 18:08:45
what's the reason for these dirty flags?
in case
vmpstr
2015/01/23 18:41:57
It's just so we don't keep copying the same vector
danakj
2015/01/23 18:43:29
I see, you need them to stick around for multiple
vmpstr
2015/01/23 18:45:58
They really only need to be on the active layer..
| |
1021 layer->SetFrameTimingRequests(frame_timing_requests_); | |
1022 frame_timing_requests_dirty_ = false; | |
1023 } | |
1024 | |
1019 // Reset any state that should be cleared for the next update. | 1025 // Reset any state that should be cleared for the next update. |
1020 stacking_order_changed_ = false; | 1026 stacking_order_changed_ = false; |
1021 update_rect_ = gfx::Rect(); | 1027 update_rect_ = gfx::Rect(); |
1022 | 1028 |
1023 needs_push_properties_ = false; | 1029 needs_push_properties_ = false; |
1024 num_dependents_need_push_properties_ = 0; | 1030 num_dependents_need_push_properties_ = 0; |
1025 } | 1031 } |
1026 | 1032 |
1027 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 1033 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
1028 return LayerImpl::Create(tree_impl, layer_id_); | 1034 return LayerImpl::Create(tree_impl, layer_id_); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1287 if (transform_tree_index() >= 0) { | 1293 if (transform_tree_index() >= 0) { |
1288 const TransformNode* node = tree.Node(transform_tree_index()); | 1294 const TransformNode* node = tree.Node(transform_tree_index()); |
1289 gfx::Transform ssxform; | 1295 gfx::Transform ssxform; |
1290 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); | 1296 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); |
1291 xform.ConcatTransform(ssxform); | 1297 xform.ConcatTransform(ssxform); |
1292 } | 1298 } |
1293 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); | 1299 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
1294 return xform; | 1300 return xform; |
1295 } | 1301 } |
1296 | 1302 |
1303 void Layer::SetFrameTimingRequests( | |
1304 const std::vector<FrameTimingRequest>& requests) { | |
1305 frame_timing_requests_ = requests; | |
1306 frame_timing_requests_dirty_ = true; | |
1307 SetNeedsCommit(); | |
1308 } | |
1309 | |
1297 } // namespace cc | 1310 } // namespace cc |
OLD | NEW |