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

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: Made DrawsContent non-virtual 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/layer.h
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index ab897a8ac9914ab08085ab45aa8b1ea8fa4ababf..2b6de6514aba996af23d16f1dd9d5987cbc0238c 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -352,6 +352,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// These methods typically need to be overwritten by derived classes.
virtual bool DrawsContent() const;
+ virtual int NumDescendantsThatDrawContent() const;
virtual void SavePaintProperties();
// Returns true iff any resources were updated that need to be committed.
virtual bool Update(ResourceUpdateQueue* queue,
@@ -460,6 +461,12 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
void Set3dSortingContextId(int id);
int sorting_context_id() const { return sorting_context_id_; }
+ // Called when our number of Drawable Descendants changes
danakj 2014/07/14 15:49:23 nit: s/D/d/g and add a .
awoloszyn 2014/07/14 19:38:33 Done.
+ void AddDrawableDescendants(int num);
danakj 2014/07/14 15:49:23 Can these all be protected?
awoloszyn 2014/07/14 19:38:33 Done.
+ void RemoveDrawableDescendants(int num);
+
+ void SetDrawsContent(bool draws_content);
+
protected:
friend class LayerImpl;
friend class TreeSynchronizer;
@@ -486,6 +493,9 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// unused resources on the impl thread are returned before commit completes.
void SetNextCommitWaitsForActivation();
+ // Will relcalculate whether or not we draw content and set draws_content_
+ // appropriately.
+ virtual void UpdateDrawsContent(bool draws_content);
void AddDependentNeedsPushProperties();
void RemoveDependentNeedsPushProperties();
bool parent_should_know_need_push_properties() const {
@@ -579,6 +589,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 +598,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;

Powered by Google App Engine
This is Rietveld 408576698