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

Side by Side Diff: cc/paint/display_item_list.h

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: danakj review Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/paint/display_item_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PAINT_DISPLAY_ITEM_LIST_H_ 5 #ifndef CC_PAINT_DISPLAY_ITEM_LIST_H_
6 #define CC_PAINT_DISPLAY_ITEM_LIST_H_ 6 #define CC_PAINT_DISPLAY_ITEM_LIST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const auto& item = 118 const auto& item =
119 AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...); 119 AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...);
120 has_discardable_images_ |= item.picture->HasDiscardableImages(); 120 has_discardable_images_ |= item.picture->HasDiscardableImages();
121 return item; 121 return item;
122 } 122 }
123 123
124 // Called after all items are appended, to process the items and, if 124 // Called after all items are appended, to process the items and, if
125 // applicable, create an internally cached SkPicture. 125 // applicable, create an internally cached SkPicture.
126 void Finalize(); 126 void Finalize();
127 127
128 void SetIsSuitableForGpuRasterization(bool is_suitable) { 128 void SetNumSlowPaths(int num_slow_paths) { num_slow_paths_ = num_slow_paths; }
129 all_items_are_suitable_for_gpu_rasterization_ = is_suitable; 129 int NumSlowPaths() const { return num_slow_paths_; }
130 }
131 bool IsSuitableForGpuRasterization() const;
132 130
133 size_t OpCount() const; 131 size_t OpCount() const;
134 size_t ApproximateMemoryUsage() const; 132 size_t ApproximateMemoryUsage() const;
135 bool ShouldBeAnalyzedForSolidColor() const; 133 bool ShouldBeAnalyzedForSolidColor() const;
136 134
137 void EmitTraceSnapshot() const; 135 void EmitTraceSnapshot() const;
138 136
139 void GenerateDiscardableImagesMetadata(); 137 void GenerateDiscardableImagesMetadata();
140 void GetDiscardableImagesInRect(const gfx::Rect& rect, 138 void GetDiscardableImagesInRect(const gfx::Rect& rect,
141 float contents_scale, 139 float contents_scale,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 191
194 // The visual rects associated with each of the display items in the 192 // The visual rects associated with each of the display items in the
195 // display item list. There is one rect per display item, and the 193 // display item list. There is one rect per display item, and the
196 // position in |visual_rects| matches the position of the item in 194 // position in |visual_rects| matches the position of the item in
197 // |items| . These rects are intentionally kept separate 195 // |items| . These rects are intentionally kept separate
198 // because they are not needed while walking the |items| for raster. 196 // because they are not needed while walking the |items| for raster.
199 std::vector<gfx::Rect> visual_rects_; 197 std::vector<gfx::Rect> visual_rects_;
200 std::vector<size_t> begin_item_indices_; 198 std::vector<size_t> begin_item_indices_;
201 199
202 size_t op_count_ = 0u; 200 size_t op_count_ = 0u;
203 bool all_items_are_suitable_for_gpu_rasterization_ = true; 201 int num_slow_paths_ = 0;
204 // For testing purposes only. Whether to keep visual rects across calls to 202 // For testing purposes only. Whether to keep visual rects across calls to
205 // Finalize(). 203 // Finalize().
206 bool retain_visual_rects_ = false; 204 bool retain_visual_rects_ = false;
207 bool has_discardable_images_ = false; 205 bool has_discardable_images_ = false;
208 206
209 friend class base::RefCountedThreadSafe<DisplayItemList>; 207 friend class base::RefCountedThreadSafe<DisplayItemList>;
210 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage); 208 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
211 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); 209 DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
212 }; 210 };
213 211
214 } // namespace cc 212 } // namespace cc
215 213
216 #endif // CC_PAINT_DISPLAY_ITEM_LIST_H_ 214 #endif // CC_PAINT_DISPLAY_ITEM_LIST_H_
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/paint/display_item_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698