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); |