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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/io_surface_layer.cc ('k') | cc/layers/layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.h
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index ab897a8ac9914ab08085ab45aa8b1ea8fa4ababf..92b939a94ec9369e8ca7157323fb1849ce5fa070 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -331,7 +331,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
virtual void SetLayerTreeHost(LayerTreeHost* host);
- bool HasDelegatedContent() const { return false; }
+ virtual bool HasDelegatedContent() const;
bool HasContributingDelegatedRenderPasses() const { return false; }
void SetIsDrawable(bool is_drawable);
@@ -350,8 +350,13 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
(mask_layer_.get() || replica_layer_->mask_layer_.get());
}
- // These methods typically need to be overwritten by derived classes.
+ int NumDescendantsThatDrawContent() const;
+
+ // This is only virtual for tests.
+ // TODO(awoloszyn): Remove this once we no longer need it for tests
virtual bool DrawsContent() const;
+
+ // This methods typically need to be overwritten by derived classes.
virtual void SavePaintProperties();
// Returns true iff any resources were updated that need to be committed.
virtual bool Update(ResourceUpdateQueue* queue,
@@ -486,6 +491,14 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// unused resources on the impl thread are returned before commit completes.
void SetNextCommitWaitsForActivation();
+ // Will recalculate whether the layer draws content and set draws_content_
+ // appropriately.
+ void UpdateDrawsContent(bool has_drawable_content);
+ virtual bool HasDrawableContent() const;
+
+ // Called when the layer's number of drawable descendants changes.
+ void AddDrawableDescendants(int num);
+
void AddDependentNeedsPushProperties();
void RemoveDependentNeedsPushProperties();
bool parent_should_know_need_push_properties() const {
@@ -579,6 +592,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// transformed relative to this layer, defines the maximum scroll offset for
// this layer.
int scroll_clip_layer_id_;
+ int num_descendants_that_draw_content_;
bool should_scroll_on_main_thread_ : 1;
bool have_wheel_event_handlers_ : 1;
bool have_scroll_event_handlers_ : 1;
@@ -587,6 +601,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
bool is_root_for_isolated_group_ : 1;
bool is_container_for_fixed_position_layers_ : 1;
bool is_drawable_ : 1;
+ bool draws_content_ : 1;
bool hide_layer_and_subtree_ : 1;
bool masks_to_bounds_ : 1;
bool contents_opaque_ : 1;
« no previous file with comments | « cc/layers/io_surface_layer.cc ('k') | cc/layers/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698