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

Side by Side Diff: cc/trees/damage_tracker.h

Issue 79173005: Improve DamageTracker performance. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/damage_tracker.cc » ('j') | cc/trees/damage_tracker.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TREES_DAMAGE_TRACKER_H_ 5 #ifndef CC_TREES_DAMAGE_TRACKER_H_
6 #define CC_TREES_DAMAGE_TRACKER_H_ 6 #define CC_TREES_DAMAGE_TRACKER_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 private: 47 private:
48 DamageTracker(); 48 DamageTracker();
49 49
50 gfx::RectF TrackDamageFromActiveLayers( 50 gfx::RectF TrackDamageFromActiveLayers(
51 const LayerImplList& layer_list, 51 const LayerImplList& layer_list,
52 int target_surface_layer_id); 52 int target_surface_layer_id);
53 gfx::RectF TrackDamageFromSurfaceMask(LayerImpl* target_surface_mask_layer); 53 gfx::RectF TrackDamageFromSurfaceMask(LayerImpl* target_surface_mask_layer);
54 gfx::RectF TrackDamageFromLeftoverRects(); 54 gfx::RectF TrackDamageFromLeftoverRects();
55 55
56 gfx::RectF RemoveRectFromCurrentFrame(int layer_id, bool* layer_is_new); 56 void PrepareRectHistoryForUpdate();
57 void SaveRectForNextFrame(int layer_id, const gfx::RectF& target_space_rect);
58 57
59 // These helper functions are used only in TrackDamageFromActiveLayers(). 58 // These helper functions are used only in TrackDamageFromActiveLayers().
60 void ExtendDamageForLayer(LayerImpl* layer, gfx::RectF* target_damage_rect); 59 void ExtendDamageForLayer(LayerImpl* layer, gfx::RectF* target_damage_rect);
61 void ExtendDamageForRenderSurface(LayerImpl* layer, 60 void ExtendDamageForRenderSurface(LayerImpl* layer,
62 gfx::RectF* target_damage_rect); 61 gfx::RectF* target_damage_rect);
63 62
64 // To correctly track exposed regions, two hashtables of rects are maintained. 63 struct RectMapData {
danakj 2013/11/21 00:13:40 formatting is off, please run git cl format on the
ostap 2013/11/21 17:06:23 Great! Didn't know about "cl format"! Done
65 // The "current" map is used to compute exposed regions of the current frame, 64 RectMapData() : updated_(false) {}
66 // while the "next" map is used to collect layer rects that are used in the 65 void Update(const gfx::RectF& rect) {
67 // next frame. 66 rect_ = rect;
68 typedef base::hash_map<int, gfx::RectF> RectMap; 67 updated_ = true;
69 scoped_ptr<RectMap> current_rect_history_; 68 }
70 scoped_ptr<RectMap> next_rect_history_; 69
70 gfx::RectF rect_;
71 bool updated_;
72
73 };
74 typedef base::hash_map<int, RectMapData> RectMap;
75
76 RectMapData& RectDataForLayer(int layer_id, bool* layer_is_new);
77
78 RectMap rect_history_;
71 79
72 gfx::RectF current_damage_rect_; 80 gfx::RectF current_damage_rect_;
73 81
74 DISALLOW_COPY_AND_ASSIGN(DamageTracker); 82 DISALLOW_COPY_AND_ASSIGN(DamageTracker);
75 }; 83 };
76 84
77 } // namespace cc 85 } // namespace cc
78 86
79 #endif // CC_TREES_DAMAGE_TRACKER_H_ 87 #endif // CC_TREES_DAMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/trees/damage_tracker.cc » ('j') | cc/trees/damage_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698