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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 force_render_surface_(false), | 71 force_render_surface_(false), |
72 transform_is_invertible_(true), | 72 transform_is_invertible_(true), |
73 has_render_surface_(false), | 73 has_render_surface_(false), |
74 background_color_(0), | 74 background_color_(0), |
75 opacity_(1.f), | 75 opacity_(1.f), |
76 blend_mode_(SkXfermode::kSrcOver_Mode), | 76 blend_mode_(SkXfermode::kSrcOver_Mode), |
77 scroll_parent_(nullptr), | 77 scroll_parent_(nullptr), |
78 clip_parent_(nullptr), | 78 clip_parent_(nullptr), |
79 replica_layer_(nullptr), | 79 replica_layer_(nullptr), |
80 raster_scale_(0.f), | 80 raster_scale_(0.f), |
81 client_(nullptr) { | 81 client_(nullptr), |
| 82 frame_timing_requests_dirty_(false) { |
82 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); | 83 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
83 layer_animation_controller_->AddValueObserver(this); | 84 layer_animation_controller_->AddValueObserver(this); |
84 layer_animation_controller_->set_value_provider(this); | 85 layer_animation_controller_->set_value_provider(this); |
85 } | 86 } |
86 | 87 |
87 Layer::~Layer() { | 88 Layer::~Layer() { |
88 // Our parent should be holding a reference to us so there should be no | 89 // Our parent should be holding a reference to us so there should be no |
89 // way for us to be destroyed while we still have a parent. | 90 // way for us to be destroyed while we still have a parent. |
90 DCHECK(!parent()); | 91 DCHECK(!parent()); |
91 // Similarly we shouldn't have a layer tree host since it also keeps a | 92 // Similarly we shouldn't have a layer tree host since it also keeps a |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 1007 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
1007 // union) any update changes that have occurred on the main thread. | 1008 // union) any update changes that have occurred on the main thread. |
1008 update_rect_.Union(layer->update_rect()); | 1009 update_rect_.Union(layer->update_rect()); |
1009 layer->SetUpdateRect(update_rect_); | 1010 layer->SetUpdateRect(update_rect_); |
1010 | 1011 |
1011 layer->SetStackingOrderChanged(stacking_order_changed_); | 1012 layer->SetStackingOrderChanged(stacking_order_changed_); |
1012 | 1013 |
1013 layer_animation_controller_->PushAnimationUpdatesTo( | 1014 layer_animation_controller_->PushAnimationUpdatesTo( |
1014 layer->layer_animation_controller()); | 1015 layer->layer_animation_controller()); |
1015 | 1016 |
| 1017 if (frame_timing_requests_dirty_) { |
| 1018 layer->PassFrameTimingRequests(&frame_timing_requests_); |
| 1019 frame_timing_requests_dirty_ = false; |
| 1020 } |
| 1021 |
1016 // Reset any state that should be cleared for the next update. | 1022 // Reset any state that should be cleared for the next update. |
1017 stacking_order_changed_ = false; | 1023 stacking_order_changed_ = false; |
1018 update_rect_ = gfx::Rect(); | 1024 update_rect_ = gfx::Rect(); |
1019 | 1025 |
1020 needs_push_properties_ = false; | 1026 needs_push_properties_ = false; |
1021 num_dependents_need_push_properties_ = 0; | 1027 num_dependents_need_push_properties_ = 0; |
1022 } | 1028 } |
1023 | 1029 |
1024 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 1030 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
1025 return LayerImpl::Create(tree_impl, layer_id_); | 1031 return LayerImpl::Create(tree_impl, layer_id_); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 if (transform_tree_index() >= 0) { | 1286 if (transform_tree_index() >= 0) { |
1281 const TransformNode* node = tree.Node(transform_tree_index()); | 1287 const TransformNode* node = tree.Node(transform_tree_index()); |
1282 gfx::Transform ssxform; | 1288 gfx::Transform ssxform; |
1283 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); | 1289 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); |
1284 xform.ConcatTransform(ssxform); | 1290 xform.ConcatTransform(ssxform); |
1285 } | 1291 } |
1286 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); | 1292 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
1287 return xform; | 1293 return xform; |
1288 } | 1294 } |
1289 | 1295 |
| 1296 void Layer::SetFrameTimingRequests( |
| 1297 const std::vector<FrameTimingRequest>& requests) { |
| 1298 frame_timing_requests_ = requests; |
| 1299 frame_timing_requests_dirty_ = true; |
| 1300 SetNeedsCommit(); |
| 1301 } |
| 1302 |
1290 } // namespace cc | 1303 } // namespace cc |
OLD | NEW |