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

Side by Side Diff: cc/layers/layer.h

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
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 #ifndef CC_LAYERS_LAYER_H_ 5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_ 6 #define CC_LAYERS_LAYER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 void set_use_parent_backface_visibility(bool use) { 325 void set_use_parent_backface_visibility(bool use) {
326 use_parent_backface_visibility_ = use; 326 use_parent_backface_visibility_ = use;
327 } 327 }
328 bool use_parent_backface_visibility() const { 328 bool use_parent_backface_visibility() const {
329 return use_parent_backface_visibility_; 329 return use_parent_backface_visibility_;
330 } 330 }
331 331
332 virtual void SetLayerTreeHost(LayerTreeHost* host); 332 virtual void SetLayerTreeHost(LayerTreeHost* host);
333 333
334 bool HasDelegatedContent() const { return false; } 334 virtual bool HasDelegatedContent() const;
335 bool HasContributingDelegatedRenderPasses() const { return false; } 335 bool HasContributingDelegatedRenderPasses() const { return false; }
336 336
337 void SetIsDrawable(bool is_drawable); 337 void SetIsDrawable(bool is_drawable);
338 338
339 void SetHideLayerAndSubtree(bool hide); 339 void SetHideLayerAndSubtree(bool hide);
340 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } 340 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; }
341 341
342 void SetReplicaLayer(Layer* layer); 342 void SetReplicaLayer(Layer* layer);
343 Layer* replica_layer() { return replica_layer_.get(); } 343 Layer* replica_layer() { return replica_layer_.get(); }
344 const Layer* replica_layer() const { return replica_layer_.get(); } 344 const Layer* replica_layer() const { return replica_layer_.get(); }
345 345
346 bool has_mask() const { return !!mask_layer_.get(); } 346 bool has_mask() const { return !!mask_layer_.get(); }
347 bool has_replica() const { return !!replica_layer_.get(); } 347 bool has_replica() const { return !!replica_layer_.get(); }
348 bool replica_has_mask() const { 348 bool replica_has_mask() const {
349 return replica_layer_.get() && 349 return replica_layer_.get() &&
350 (mask_layer_.get() || replica_layer_->mask_layer_.get()); 350 (mask_layer_.get() || replica_layer_->mask_layer_.get());
351 } 351 }
352 352
353 // These methods typically need to be overwritten by derived classes. 353 int NumDescendantsThatDrawContent() const;
354
355 // This is only virtual for tests.
danakj 2014/07/17 17:21:25 is this something we should change? maybe in a fol
awoloszyn 2014/07/17 20:44:59 It might be good to change this in a followup. It
354 virtual bool DrawsContent() const; 356 virtual bool DrawsContent() const;
357
358 // This methods typically need to be overwritten by derived classes.
355 virtual void SavePaintProperties(); 359 virtual void SavePaintProperties();
356 // Returns true iff any resources were updated that need to be committed. 360 // Returns true iff any resources were updated that need to be committed.
357 virtual bool Update(ResourceUpdateQueue* queue, 361 virtual bool Update(ResourceUpdateQueue* queue,
358 const OcclusionTracker<Layer>* occlusion); 362 const OcclusionTracker<Layer>* occlusion);
359 virtual bool NeedMoreUpdates(); 363 virtual bool NeedMoreUpdates();
360 virtual void SetIsMask(bool is_mask) {} 364 virtual void SetIsMask(bool is_mask) {}
361 virtual void ReduceMemoryUsage() {} 365 virtual void ReduceMemoryUsage() {}
362 virtual void OnOutputSurfaceCreated() {} 366 virtual void OnOutputSurfaceCreated() {}
363 virtual bool IsSuitableForGpuRasterization() const; 367 virtual bool IsSuitableForGpuRasterization() const;
364 368
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 void SetNeedsCommit(); 483 void SetNeedsCommit();
480 // Called when there's been a change in layer structure. Implies both 484 // Called when there's been a change in layer structure. Implies both
481 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. 485 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties.
482 void SetNeedsFullTreeSync(); 486 void SetNeedsFullTreeSync();
483 487
484 // Called when the next commit should wait until the pending tree is activated 488 // Called when the next commit should wait until the pending tree is activated
485 // before finishing the commit and unblocking the main thread. Used to ensure 489 // before finishing the commit and unblocking the main thread. Used to ensure
486 // unused resources on the impl thread are returned before commit completes. 490 // unused resources on the impl thread are returned before commit completes.
487 void SetNextCommitWaitsForActivation(); 491 void SetNextCommitWaitsForActivation();
488 492
493 // Will relcalculate whether or not we draw content and set draws_content_
danakj 2014/07/17 17:21:25 recalculate s/or not//
awoloszyn 2014/07/17 20:44:59 Done.
494 // appropriately.
495 void UpdateDrawsContent(bool has_drawable_content);
496 virtual bool HasDrawableContent() const;
497
498 // Called when our number of drawable descendants changes.
499 void AddDrawableDescendants(int num);
500
489 void AddDependentNeedsPushProperties(); 501 void AddDependentNeedsPushProperties();
490 void RemoveDependentNeedsPushProperties(); 502 void RemoveDependentNeedsPushProperties();
491 bool parent_should_know_need_push_properties() const { 503 bool parent_should_know_need_push_properties() const {
492 return needs_push_properties() || descendant_needs_push_properties(); 504 return needs_push_properties() || descendant_needs_push_properties();
493 } 505 }
494 506
495 bool IsPropertyChangeAllowed() const; 507 bool IsPropertyChangeAllowed() const;
496 508
497 // If this layer has a scroll parent, it removes |this| from its list of 509 // If this layer has a scroll parent, it removes |this| from its list of
498 // scroll children. 510 // scroll children.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 scoped_refptr<LayerAnimationController> layer_animation_controller_; 584 scoped_refptr<LayerAnimationController> layer_animation_controller_;
573 585
574 // Layer properties. 586 // Layer properties.
575 gfx::Size bounds_; 587 gfx::Size bounds_;
576 588
577 gfx::Vector2d scroll_offset_; 589 gfx::Vector2d scroll_offset_;
578 // This variable indicates which ancestor layer (if any) whose size, 590 // This variable indicates which ancestor layer (if any) whose size,
579 // transformed relative to this layer, defines the maximum scroll offset for 591 // transformed relative to this layer, defines the maximum scroll offset for
580 // this layer. 592 // this layer.
581 int scroll_clip_layer_id_; 593 int scroll_clip_layer_id_;
594 int num_descendants_that_draw_content_;
582 bool should_scroll_on_main_thread_ : 1; 595 bool should_scroll_on_main_thread_ : 1;
583 bool have_wheel_event_handlers_ : 1; 596 bool have_wheel_event_handlers_ : 1;
584 bool have_scroll_event_handlers_ : 1; 597 bool have_scroll_event_handlers_ : 1;
585 bool user_scrollable_horizontal_ : 1; 598 bool user_scrollable_horizontal_ : 1;
586 bool user_scrollable_vertical_ : 1; 599 bool user_scrollable_vertical_ : 1;
587 bool is_root_for_isolated_group_ : 1; 600 bool is_root_for_isolated_group_ : 1;
588 bool is_container_for_fixed_position_layers_ : 1; 601 bool is_container_for_fixed_position_layers_ : 1;
589 bool is_drawable_ : 1; 602 bool is_drawable_ : 1;
603 bool draws_content_ : 1;
590 bool hide_layer_and_subtree_ : 1; 604 bool hide_layer_and_subtree_ : 1;
591 bool masks_to_bounds_ : 1; 605 bool masks_to_bounds_ : 1;
592 bool contents_opaque_ : 1; 606 bool contents_opaque_ : 1;
593 bool double_sided_ : 1; 607 bool double_sided_ : 1;
594 bool should_flatten_transform_ : 1; 608 bool should_flatten_transform_ : 1;
595 bool use_parent_backface_visibility_ : 1; 609 bool use_parent_backface_visibility_ : 1;
596 bool draw_checkerboard_for_missing_tiles_ : 1; 610 bool draw_checkerboard_for_missing_tiles_ : 1;
597 bool force_render_surface_ : 1; 611 bool force_render_surface_ : 1;
598 bool transform_is_invertible_ : 1; 612 bool transform_is_invertible_ : 1;
599 Region non_fast_scrollable_region_; 613 Region non_fast_scrollable_region_;
(...skipping 29 matching lines...) Expand all
629 DrawProperties<Layer> draw_properties_; 643 DrawProperties<Layer> draw_properties_;
630 644
631 PaintProperties paint_properties_; 645 PaintProperties paint_properties_;
632 646
633 DISALLOW_COPY_AND_ASSIGN(Layer); 647 DISALLOW_COPY_AND_ASSIGN(Layer);
634 }; 648 };
635 649
636 } // namespace cc 650 } // namespace cc
637 651
638 #endif // CC_LAYERS_LAYER_H_ 652 #endif // CC_LAYERS_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698