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

Unified Diff: cc/playback/display_item_list.h

Issue 2149743003: cc: Clean up DisplayItemList API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit addressed Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/playback/display_item_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/display_item_list.h
diff --git a/cc/playback/display_item_list.h b/cc/playback/display_item_list.h
index 710284e4c579c06173390638cf643dafada9c1ea..402e73f421f99678de974f9b5680d71c9afc2e44 100644
--- a/cc/playback/display_item_list.h
+++ b/cc/playback/display_item_list.h
@@ -76,8 +76,8 @@ class CC_EXPORT DisplayItemList
template <typename DisplayItemType, typename... Args>
const DisplayItemType& CreateAndAppendItem(const gfx::Rect& visual_rect,
Args&&... args) {
- visual_rects_.push_back(visual_rect);
- auto* item = &items_.AllocateAndConstruct<DisplayItemType>(
+ inputs_.visual_rects.push_back(visual_rect);
+ auto* item = &inputs_.items.AllocateAndConstruct<DisplayItemType>(
std::forward<Args>(args)...);
approximate_op_count_ += item->ApproximateOpCount();
ProcessAppendedItem(item);
@@ -89,7 +89,7 @@ class CC_EXPORT DisplayItemList
void Finalize();
void SetIsSuitableForGpuRasterization(bool is_suitable) {
- is_suitable_for_gpu_rasterization_ = is_suitable;
+ inputs_.is_suitable_for_gpu_rasterization = is_suitable;
}
bool IsSuitableForGpuRasterization() const;
int ApproximateOpCount() const;
@@ -108,14 +108,16 @@ class CC_EXPORT DisplayItemList
float raster_scale,
std::vector<DrawImage>* images);
- gfx::Rect VisualRectForTesting(int index) { return visual_rects_[index]; }
+ gfx::Rect VisualRectForTesting(int index) {
+ return inputs_.visual_rects[index];
+ }
ContiguousContainer<DisplayItem>::const_iterator begin() const {
- return items_.begin();
+ return inputs_.items.begin();
}
ContiguousContainer<DisplayItem>::const_iterator end() const {
- return items_.end();
+ return inputs_.items.end();
}
private:
@@ -126,21 +128,11 @@ class CC_EXPORT DisplayItemList
void ProcessAppendedItem(const DisplayItem* item);
- ContiguousContainer<DisplayItem> items_;
- // The visual rects associated with each of the display items in the
- // display item list. There is one rect per display item, and the
- // position in |visual_rects_| matches the position of the item in
- // |items_| . These rects are intentionally kept separate
- // because they are not needed while walking the |items_| for raster.
- std::vector<gfx::Rect> visual_rects_;
sk_sp<SkPicture> picture_;
std::unique_ptr<SkPictureRecorder> recorder_;
- const DisplayItemListSettings settings_;
- bool retain_individual_display_items_;
- gfx::Rect layer_rect_;
- bool is_suitable_for_gpu_rasterization_;
+ bool retain_individual_display_items_;
int approximate_op_count_;
// Memory usage due to the cached SkPicture.
@@ -148,6 +140,25 @@ class CC_EXPORT DisplayItemList
DiscardableImageMap image_map_;
+ struct Inputs {
+ Inputs(gfx::Rect layer_rect, const DisplayItemListSettings& settings);
+ ~Inputs();
+
+ ContiguousContainer<DisplayItem> items;
+ // The visual rects associated with each of the display items in the
+ // display item list. There is one rect per display item, and the
+ // position in |visual_rects| matches the position of the item in
+ // |items| . These rects are intentionally kept separate
+ // because they are not needed while walking the |items| for raster.
+ std::vector<gfx::Rect> visual_rects;
+
+ const DisplayItemListSettings settings;
+ gfx::Rect layer_rect;
+ bool is_suitable_for_gpu_rasterization;
+ };
+
+ Inputs inputs_;
+
friend class base::RefCountedThreadSafe<DisplayItemList>;
FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
« no previous file with comments | « no previous file | cc/playback/display_item_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698