Chromium Code Reviews| Index: cc/trees/damage_tracker.h |
| diff --git a/cc/trees/damage_tracker.h b/cc/trees/damage_tracker.h |
| index fbcaa69824df97de458e29d2c0c81fd1a315834b..55788c5ec8048a4cf89278f5cb439d42844a3512 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,23 +52,37 @@ 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) { |
| + rect_ = rect; |
| + mailboxId_ = mailboxId; |
| + } |
| + |
| + bool operator < (const RectMapData& other) { |
| + return layer_id_ < other.layer_id_; |
| + } |
| + |
| + int layer_id_; |
| + gfx::RectF rect_; |
| + unsigned int mailboxId_; |
|
shawnsingh
2013/11/23 01:32:01
Let's declare mailboxId_ above rect_, on the very
ostap
2013/11/25 16:11:39
Done.
|
| + }; |
| + typedef std::vector<RectMapData> SortedRectMap; |
| + |
| + RectMapData& RectDataForLayer(int layer_id, bool* layer_is_new); |
| + |
| + SortedRectMap rect_history_; |
| gfx::RectF current_damage_rect_; |
| + unsigned int mailboxId_; |
| DISALLOW_COPY_AND_ASSIGN(DamageTracker); |
| }; |