Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: cc/trees/layer_tree_impl.h

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #ifndef CC_TREES_LAYER_TREE_IMPL_H_ 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_
6 #define CC_TREES_LAYER_TREE_IMPL_H_ 6 #define CC_TREES_LAYER_TREE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 void PushPropertiesTo(LayerTreeImpl* tree_impl); 150 void PushPropertiesTo(LayerTreeImpl* tree_impl);
151 151
152 void MoveChangeTrackingToLayers(); 152 void MoveChangeTrackingToLayers();
153 153
154 LayerImplList::const_iterator begin() const; 154 LayerImplList::const_iterator begin() const;
155 LayerImplList::const_iterator end() const; 155 LayerImplList::const_iterator end() const;
156 LayerImplList::reverse_iterator rbegin(); 156 LayerImplList::reverse_iterator rbegin();
157 LayerImplList::reverse_iterator rend(); 157 LayerImplList::reverse_iterator rend();
158 158
159 struct CC_EXPORT ElementLayers {
160 // Transform and opacity mutations apply to this layer.
161 LayerImpl* main = nullptr;
162 // Scroll mutations apply to this layer.
163 LayerImpl* scroll = nullptr;
164 };
165
166 void AddToElementMap(LayerImpl* layer);
167 void RemoveFromElementMap(LayerImpl* layer);
168
169 void AddToOpacityAnimationsMap(int id, float opacity); 159 void AddToOpacityAnimationsMap(int id, float opacity);
170 void AddToTransformAnimationsMap(int id, gfx::Transform transform); 160 void AddToTransformAnimationsMap(int id, gfx::Transform transform);
171 161
172 ElementLayers GetMutableLayers(uint64_t element_id);
173 int source_frame_number() const { return source_frame_number_; } 162 int source_frame_number() const { return source_frame_number_; }
174 void set_source_frame_number(int frame_number) { 163 void set_source_frame_number(int frame_number) {
175 source_frame_number_ = frame_number; 164 source_frame_number_ = frame_number;
176 } 165 }
177 166
178 bool is_first_frame_after_commit() const { 167 bool is_first_frame_after_commit() const {
179 return source_frame_number_ != is_first_frame_after_commit_tracker_; 168 return source_frame_number_ != is_first_frame_after_commit_tracker_;
180 } 169 }
181 170
182 void set_is_first_frame_after_commit(bool is_first_frame_after_commit) { 171 void set_is_first_frame_after_commit(bool is_first_frame_after_commit) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return elastic_overscroll_.get(); 249 return elastic_overscroll_.get();
261 } 250 }
262 251
263 SyncedTopControls* top_controls_shown_ratio() { 252 SyncedTopControls* top_controls_shown_ratio() {
264 return top_controls_shown_ratio_.get(); 253 return top_controls_shown_ratio_.get();
265 } 254 }
266 const SyncedTopControls* top_controls_shown_ratio() const { 255 const SyncedTopControls* top_controls_shown_ratio() const {
267 return top_controls_shown_ratio_.get(); 256 return top_controls_shown_ratio_.get();
268 } 257 }
269 258
259 void SetElementIdsForTesting();
260
270 // Updates draw properties and render surface layer list, as well as tile 261 // Updates draw properties and render surface layer list, as well as tile
271 // priorities. Returns false if it was unable to update. Updating lcd 262 // priorities. Returns false if it was unable to update. Updating lcd
272 // text may cause invalidations, so should only be done after a commit. 263 // text may cause invalidations, so should only be done after a commit.
273 bool UpdateDrawProperties(bool update_lcd_text); 264 bool UpdateDrawProperties(bool update_lcd_text);
274 void BuildLayerListAndPropertyTreesForTesting(); 265 void BuildLayerListAndPropertyTreesForTesting();
275 266
276 void set_needs_update_draw_properties() { 267 void set_needs_update_draw_properties() {
277 needs_update_draw_properties_ = true; 268 needs_update_draw_properties_ = true;
278 } 269 }
279 bool needs_update_draw_properties() const { 270 bool needs_update_draw_properties() const {
(...skipping 22 matching lines...) Expand all
302 293
303 // These return the size of the root scrollable area and the size of 294 // These return the size of the root scrollable area and the size of
304 // the user-visible scrolling viewport, in CSS layout coordinates. 295 // the user-visible scrolling viewport, in CSS layout coordinates.
305 gfx::SizeF ScrollableSize() const; 296 gfx::SizeF ScrollableSize() const;
306 gfx::SizeF ScrollableViewportSize() const; 297 gfx::SizeF ScrollableViewportSize() const;
307 298
308 gfx::Rect RootScrollLayerDeviceViewportBounds() const; 299 gfx::Rect RootScrollLayerDeviceViewportBounds() const;
309 300
310 LayerImpl* LayerById(int id) const; 301 LayerImpl* LayerById(int id) const;
311 302
303 // TODO(vollick): this is deprecated. It is used by
304 // animation/compositor-worker to look up layers to mutate, but in future, we
305 // will update property trees.
306 LayerImpl* LayerByElementId(ElementId element_id) const;
307 void AddToElementMap(LayerImpl* layer);
308 void RemoveFromElementMap(LayerImpl* layer);
309
312 void AddLayerShouldPushProperties(LayerImpl* layer); 310 void AddLayerShouldPushProperties(LayerImpl* layer);
313 void RemoveLayerShouldPushProperties(LayerImpl* layer); 311 void RemoveLayerShouldPushProperties(LayerImpl* layer);
314 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); 312 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties();
315 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); 313 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer);
316 314
317 // These should be called by LayerImpl's ctor/dtor. 315 // These should be called by LayerImpl's ctor/dtor.
318 void RegisterLayer(LayerImpl* layer); 316 void RegisterLayer(LayerImpl* layer);
319 void UnregisterLayer(LayerImpl* layer); 317 void UnregisterLayer(LayerImpl* layer);
320 318
321 // These manage ownership of the LayerImpl. 319 // These manage ownership of the LayerImpl.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 float painted_device_scale_factor_; 523 float painted_device_scale_factor_;
526 524
527 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_; 525 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll_;
528 526
529 std::unique_ptr<OwnedLayerImplList> layers_; 527 std::unique_ptr<OwnedLayerImplList> layers_;
530 LayerImplMap layer_id_map_; 528 LayerImplMap layer_id_map_;
531 LayerImplList layer_list_; 529 LayerImplList layer_list_;
532 // Set of layers that need to push properties. 530 // Set of layers that need to push properties.
533 std::unordered_set<LayerImpl*> layers_that_should_push_properties_; 531 std::unordered_set<LayerImpl*> layers_that_should_push_properties_;
534 532
535 std::unordered_map<uint64_t, ElementLayers> element_layers_map_; 533 std::unordered_map<ElementId, LayerImpl*, ElementIdHash> element_layers_map_;
536 534
537 std::unordered_map<int, float> opacity_animations_map_; 535 std::unordered_map<int, float> opacity_animations_map_;
538 std::unordered_map<int, gfx::Transform> transform_animations_map_; 536 std::unordered_map<int, gfx::Transform> transform_animations_map_;
539 537
540 // Maps from clip layer ids to scroll layer ids. Note that this only includes 538 // Maps from clip layer ids to scroll layer ids. Note that this only includes
541 // the subset of clip layers that act as scrolling containers. (This is 539 // the subset of clip layers that act as scrolling containers. (This is
542 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.) 540 // derived from LayerImpl::scroll_clip_layer_ and exists to avoid O(n) walks.)
543 std::unordered_map<int, int> clip_scroll_map_; 541 std::unordered_map<int, int> clip_scroll_map_;
544 542
545 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there 543 // Maps scroll layer ids to scrollbar layer ids. For each scroll layer, there
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 586
589 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 587 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
590 588
591 private: 589 private:
592 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 590 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
593 }; 591 };
594 592
595 } // namespace cc 593 } // namespace cc
596 594
597 #endif // CC_TREES_LAYER_TREE_IMPL_H_ 595 #endif // CC_TREES_LAYER_TREE_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698