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

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

Issue 2876033005: Track slow paths in DisplayItemList (Closed)
Patch Set: Created 3 years, 7 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const auto& item = 123 const auto& item =
124 AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...); 124 AllocateAndConstruct<DisplayItemType>(std::forward<Args>(args)...);
125 has_discardable_images_ |= item.picture->HasDiscardableImages(); 125 has_discardable_images_ |= item.picture->HasDiscardableImages();
126 return item; 126 return item;
127 } 127 }
128 128
129 // Called after all items are appended, to process the items and, if 129 // Called after all items are appended, to process the items and, if
130 // applicable, create an internally cached SkPicture. 130 // applicable, create an internally cached SkPicture.
131 void Finalize(); 131 void Finalize();
132 132
133 void SetIsSuitableForGpuRasterization(bool is_suitable) { 133 void SetNumSlowPaths(int num_slow_paths) { num_slow_paths_ = num_slow_paths; }
134 all_items_are_suitable_for_gpu_rasterization_ = is_suitable; 134 int NumSlowPaths() const { return num_slow_paths_; }
135 }
136 bool IsSuitableForGpuRasterization() const;
137 135
138 int ApproximateOpCount() const; 136 int ApproximateOpCount() const;
139 size_t ApproximateMemoryUsage() const; 137 size_t ApproximateMemoryUsage() const;
140 bool ShouldBeAnalyzedForSolidColor() const; 138 bool ShouldBeAnalyzedForSolidColor() const;
141 139
142 void EmitTraceSnapshot() const; 140 void EmitTraceSnapshot() const;
143 141
144 void GenerateDiscardableImagesMetadata(); 142 void GenerateDiscardableImagesMetadata();
145 void GetDiscardableImagesInRect(const gfx::Rect& rect, 143 void GetDiscardableImagesInRect(const gfx::Rect& rect,
146 float contents_scale, 144 float contents_scale,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 196
199 // The visual rects associated with each of the display items in the 197 // The visual rects associated with each of the display items in the
200 // display item list. There is one rect per display item, and the 198 // display item list. There is one rect per display item, and the
201 // position in |visual_rects| matches the position of the item in 199 // position in |visual_rects| matches the position of the item in
202 // |items| . These rects are intentionally kept separate 200 // |items| . These rects are intentionally kept separate
203 // because they are not needed while walking the |items| for raster. 201 // because they are not needed while walking the |items| for raster.
204 std::vector<gfx::Rect> visual_rects_; 202 std::vector<gfx::Rect> visual_rects_;
205 std::vector<size_t> begin_item_indices_; 203 std::vector<size_t> begin_item_indices_;
206 204
207 int approximate_op_count_ = 0; 205 int approximate_op_count_ = 0;
208 bool all_items_are_suitable_for_gpu_rasterization_ = true; 206 int num_slow_paths_ = 0;
209 // For testing purposes only. Whether to keep visual rects across calls to 207 // For testing purposes only. Whether to keep visual rects across calls to
210 // Finalize(). 208 // Finalize().
211 bool retain_visual_rects_ = false; 209 bool retain_visual_rects_ = false;
212 bool has_discardable_images_ = false; 210 bool has_discardable_images_ = false;
213 211
214 friend class base::RefCountedThreadSafe<DisplayItemList>; 212 friend class base::RefCountedThreadSafe<DisplayItemList>;
215 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage); 213 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
216 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); 214 DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
217 }; 215 };
218 216
219 } // namespace cc 217 } // namespace cc
220 218
221 #endif // CC_PAINT_DISPLAY_ITEM_LIST_H_ 219 #endif // CC_PAINT_DISPLAY_ITEM_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698