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

Unified Diff: cc/trees/damage_tracker.h

Issue 79173005: Improve DamageTracker performance. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Fix clang compile issues. Created 7 years, 1 month 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 | « no previous file | cc/trees/damage_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/damage_tracker.h
diff --git a/cc/trees/damage_tracker.h b/cc/trees/damage_tracker.h
index fbcaa69824df97de458e29d2c0c81fd1a315834b..37a1900f78811bcec5c7817e6afb9ba48017b03f 100644
--- a/cc/trees/damage_tracker.h
+++ b/cc/trees/damage_tracker.h
@@ -6,7 +6,6 @@
#define CC_TREES_DAMAGE_TRACKER_H_
#include <vector>
-#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/layers/layer_lists.h"
@@ -53,22 +52,36 @@ class CC_EXPORT DamageTracker {
gfx::RectF TrackDamageFromSurfaceMask(LayerImpl* target_surface_mask_layer);
gfx::RectF TrackDamageFromLeftoverRects();
- gfx::RectF RemoveRectFromCurrentFrame(int layer_id, bool* layer_is_new);
- void SaveRectForNextFrame(int layer_id, const gfx::RectF& target_space_rect);
+ void PrepareRectHistoryForUpdate();
// These helper functions are used only in TrackDamageFromActiveLayers().
void ExtendDamageForLayer(LayerImpl* layer, gfx::RectF* target_damage_rect);
void ExtendDamageForRenderSurface(LayerImpl* layer,
gfx::RectF* target_damage_rect);
- // To correctly track exposed regions, two hashtables of rects are maintained.
- // The "current" map is used to compute exposed regions of the current frame,
- // while the "next" map is used to collect layer rects that are used in the
- // next frame.
- typedef base::hash_map<int, gfx::RectF> RectMap;
- scoped_ptr<RectMap> current_rect_history_;
- scoped_ptr<RectMap> next_rect_history_;
+ struct RectMapData {
+ RectMapData() : layer_id_(0), mailboxId_(0) {}
+ explicit RectMapData(int layer_id) : layer_id_(layer_id), mailboxId_(0) {}
+ void Update(const gfx::RectF& rect, unsigned int mailboxId) {
+ mailboxId_ = mailboxId;
+ rect_ = rect;
+ }
+ bool operator < (const RectMapData& other) const {
+ return layer_id_ < other.layer_id_;
+ }
+
+ int layer_id_;
+ unsigned int mailboxId_;
+ gfx::RectF rect_;
+ };
+ typedef std::vector<RectMapData> SortedRectMap;
+
+ RectMapData& RectDataForLayer(int layer_id, bool* layer_is_new);
+
+ SortedRectMap rect_history_;
+
+ unsigned int mailboxId_;
gfx::RectF current_damage_rect_;
DISALLOW_COPY_AND_ASSIGN(DamageTracker);
« no previous file with comments | « no previous file | cc/trees/damage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698