| 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/location.h" | 10 #include "base/location.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "cc/animation/animation.h" | 15 #include "cc/animation/animation.h" |
| 16 #include "cc/animation/animation_events.h" | 16 #include "cc/animation/animation_events.h" |
| 17 #include "cc/animation/animation_registrar.h" | 17 #include "cc/animation/animation_registrar.h" |
| 18 #include "cc/animation/keyframed_animation_curve.h" | 18 #include "cc/animation/keyframed_animation_curve.h" |
| 19 #include "cc/animation/layer_animation_controller.h" | 19 #include "cc/animation/layer_animation_controller.h" |
| 20 #include "cc/animation/mutable_properties.h" |
| 20 #include "cc/base/simple_enclosed_region.h" | 21 #include "cc/base/simple_enclosed_region.h" |
| 21 #include "cc/debug/frame_viewer_instrumentation.h" | 22 #include "cc/debug/frame_viewer_instrumentation.h" |
| 22 #include "cc/layers/layer_client.h" | 23 #include "cc/layers/layer_client.h" |
| 23 #include "cc/layers/layer_impl.h" | 24 #include "cc/layers/layer_impl.h" |
| 24 #include "cc/layers/layer_proto_converter.h" | 25 #include "cc/layers/layer_proto_converter.h" |
| 25 #include "cc/layers/scrollbar_layer_interface.h" | 26 #include "cc/layers/scrollbar_layer_interface.h" |
| 26 #include "cc/output/copy_output_request.h" | 27 #include "cc/output/copy_output_request.h" |
| 27 #include "cc/output/copy_output_result.h" | 28 #include "cc/output/copy_output_result.h" |
| 28 #include "cc/proto/layer.pb.h" | 29 #include "cc/proto/layer.pb.h" |
| 29 #include "cc/trees/draw_property_utils.h" | 30 #include "cc/trees/draw_property_utils.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 51 sorting_context_id_(0), | 52 sorting_context_id_(0), |
| 52 parent_(nullptr), | 53 parent_(nullptr), |
| 53 layer_tree_host_(nullptr), | 54 layer_tree_host_(nullptr), |
| 54 scroll_clip_layer_id_(INVALID_ID), | 55 scroll_clip_layer_id_(INVALID_ID), |
| 55 num_descendants_that_draw_content_(0), | 56 num_descendants_that_draw_content_(0), |
| 56 transform_tree_index_(-1), | 57 transform_tree_index_(-1), |
| 57 effect_tree_index_(-1), | 58 effect_tree_index_(-1), |
| 58 clip_tree_index_(-1), | 59 clip_tree_index_(-1), |
| 59 property_tree_sequence_number_(-1), | 60 property_tree_sequence_number_(-1), |
| 60 num_layer_or_descendants_with_copy_request_(0), | 61 num_layer_or_descendants_with_copy_request_(0), |
| 62 element_id_(0), |
| 63 mutable_properties_(kMutablePropertyNone), |
| 61 should_flatten_transform_from_property_tree_(false), | 64 should_flatten_transform_from_property_tree_(false), |
| 62 should_scroll_on_main_thread_(false), | 65 should_scroll_on_main_thread_(false), |
| 63 have_wheel_event_handlers_(false), | 66 have_wheel_event_handlers_(false), |
| 64 have_scroll_event_handlers_(false), | 67 have_scroll_event_handlers_(false), |
| 65 user_scrollable_horizontal_(true), | 68 user_scrollable_horizontal_(true), |
| 66 user_scrollable_vertical_(true), | 69 user_scrollable_vertical_(true), |
| 67 is_root_for_isolated_group_(false), | 70 is_root_for_isolated_group_(false), |
| 68 is_container_for_fixed_position_layers_(false), | 71 is_container_for_fixed_position_layers_(false), |
| 69 is_drawable_(false), | 72 is_drawable_(false), |
| 70 draws_content_(false), | 73 draws_content_(false), |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 1234 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
| 1232 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) | 1235 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) |
| 1233 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); | 1236 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
| 1234 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 1237 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
| 1235 layer->Set3dSortingContextId(sorting_context_id_); | 1238 layer->Set3dSortingContextId(sorting_context_id_); |
| 1236 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); | 1239 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); |
| 1237 | 1240 |
| 1238 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 1241 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 1239 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 1242 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 1240 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 1243 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
| 1244 layer->SetElementId(element_id_); |
| 1245 layer->SetMutableProperties(mutable_properties_); |
| 1241 | 1246 |
| 1242 LayerImpl* scroll_parent = nullptr; | 1247 LayerImpl* scroll_parent = nullptr; |
| 1243 if (scroll_parent_) { | 1248 if (scroll_parent_) { |
| 1244 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 1249 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
| 1245 DCHECK(scroll_parent); | 1250 DCHECK(scroll_parent); |
| 1246 } | 1251 } |
| 1247 | 1252 |
| 1248 layer->SetScrollParent(scroll_parent); | 1253 layer->SetScrollParent(scroll_parent); |
| 1249 if (scroll_children_) { | 1254 if (scroll_children_) { |
| 1250 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | 1255 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 void Layer::SetFrameTimingRequests( | 1725 void Layer::SetFrameTimingRequests( |
| 1721 const std::vector<FrameTimingRequest>& requests) { | 1726 const std::vector<FrameTimingRequest>& requests) { |
| 1722 // TODO(vmpstr): Early out if there are no changes earlier in the call stack. | 1727 // TODO(vmpstr): Early out if there are no changes earlier in the call stack. |
| 1723 if (requests == frame_timing_requests_) | 1728 if (requests == frame_timing_requests_) |
| 1724 return; | 1729 return; |
| 1725 frame_timing_requests_ = requests; | 1730 frame_timing_requests_ = requests; |
| 1726 frame_timing_requests_dirty_ = true; | 1731 frame_timing_requests_dirty_ = true; |
| 1727 SetNeedsCommit(); | 1732 SetNeedsCommit(); |
| 1728 } | 1733 } |
| 1729 | 1734 |
| 1735 void Layer::SetElementId(uint64_t id) { |
| 1736 DCHECK(IsPropertyChangeAllowed()); |
| 1737 if (element_id_ == id) |
| 1738 return; |
| 1739 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 1740 "Layer::SetElementId", "id", id); |
| 1741 element_id_ = id; |
| 1742 SetNeedsCommit(); |
| 1743 } |
| 1744 |
| 1745 void Layer::SetMutableProperties(uint32_t properties) { |
| 1746 DCHECK(IsPropertyChangeAllowed()); |
| 1747 if (mutable_properties_ == properties) |
| 1748 return; |
| 1749 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 1750 "Layer::SetMutableProperties", "properties", properties); |
| 1751 mutable_properties_ = properties; |
| 1752 SetNeedsCommit(); |
| 1753 } |
| 1754 |
| 1730 void Layer::DidBeginTracing() { | 1755 void Layer::DidBeginTracing() { |
| 1731 // We'll be dumping layer trees as part of trace, so make sure | 1756 // We'll be dumping layer trees as part of trace, so make sure |
| 1732 // PushPropertiesTo() propagates layer debug info to the impl | 1757 // PushPropertiesTo() propagates layer debug info to the impl |
| 1733 // side -- otherwise this won't happen for the the layers that | 1758 // side -- otherwise this won't happen for the the layers that |
| 1734 // remain unchanged since tracing started. | 1759 // remain unchanged since tracing started. |
| 1735 SetNeedsPushProperties(); | 1760 SetNeedsPushProperties(); |
| 1736 } | 1761 } |
| 1737 | 1762 |
| 1738 void Layer::set_visited(bool visited) { | 1763 void Layer::set_visited(bool visited) { |
| 1739 visited_tracker_ = | 1764 visited_tracker_ = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 this, layer_tree_host_->property_trees()->transform_tree); | 1801 this, layer_tree_host_->property_trees()->transform_tree); |
| 1777 } | 1802 } |
| 1778 | 1803 |
| 1779 gfx::Transform Layer::screen_space_transform() const { | 1804 gfx::Transform Layer::screen_space_transform() const { |
| 1780 DCHECK_NE(transform_tree_index_, -1); | 1805 DCHECK_NE(transform_tree_index_, -1); |
| 1781 return ScreenSpaceTransformFromPropertyTrees( | 1806 return ScreenSpaceTransformFromPropertyTrees( |
| 1782 this, layer_tree_host_->property_trees()->transform_tree); | 1807 this, layer_tree_host_->property_trees()->transform_tree); |
| 1783 } | 1808 } |
| 1784 | 1809 |
| 1785 } // namespace cc | 1810 } // namespace cc |
| OLD | NEW |