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

Unified Diff: cc/playback/display_item_list.h

Issue 1484163002: Raster display item lists via a visual rect RTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback. Created 4 years, 4 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
Index: cc/playback/display_item_list.h
diff --git a/cc/playback/display_item_list.h b/cc/playback/display_item_list.h
index 402e73f421f99678de974f9b5680d71c9afc2e44..bfc06c8a1007fb056e399f1f8d25a2d0291c2128 100644
--- a/cc/playback/display_item_list.h
+++ b/cc/playback/display_item_list.h
@@ -16,11 +16,13 @@
#include "base/trace_event/trace_event.h"
#include "cc/base/cc_export.h"
#include "cc/base/contiguous_container.h"
+#include "cc/base/rtree.h"
#include "cc/playback/discardable_image_map.h"
#include "cc/playback/display_item.h"
#include "cc/playback/display_item_list_settings.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/rect_conversions.h"
class SkCanvas;
class SkPictureRecorder;
@@ -37,13 +39,8 @@ class DisplayItemList;
class CC_EXPORT DisplayItemList
: public base::RefCountedThreadSafe<DisplayItemList> {
public:
- // Creates a display item list. If picture caching is used, then layer_rect
- // specifies the cull rect of the display item list (the picture will not
- // exceed this rect). If picture caching is not used, then the given rect can
- // be empty.
- // TODO(vmpstr): Maybe this cull rect can be part of the settings instead.
+ // Creates a display item list.
static scoped_refptr<DisplayItemList> Create(
- const gfx::Rect& layer_rect,
const DisplayItemListSettings& settings);
// Creates a DisplayItemList from a Protobuf.
@@ -65,11 +62,6 @@ class CC_EXPORT DisplayItemList
void Raster(SkCanvas* canvas, SkPicture::AbortCallback* callback) const;
- // This is a fast path for use only if canvas_ is set and
- // retain_individual_display_items_ is false. This method also updates
- // approximate_op_count_.
- void RasterIntoCanvas(const DisplayItem& display_item);
-
// Because processing happens in this function, all the set up for
// this item should be done via the args, which is why the return
// type needs to be const, to prevent set-after-processing mistakes.
@@ -80,7 +72,6 @@ class CC_EXPORT DisplayItemList
auto* item = &inputs_.items.AllocateAndConstruct<DisplayItemType>(
std::forward<Args>(args)...);
approximate_op_count_ += item->ApproximateOpCount();
- ProcessAppendedItem(item);
return *item;
}
@@ -89,15 +80,13 @@ class CC_EXPORT DisplayItemList
void Finalize();
void SetIsSuitableForGpuRasterization(bool is_suitable) {
- inputs_.is_suitable_for_gpu_rasterization = is_suitable;
+ inputs_.all_items_are_suitable_for_gpu_rasterization = is_suitable;
}
bool IsSuitableForGpuRasterization() const;
int ApproximateOpCount() const;
size_t ApproximateMemoryUsage() const;
bool ShouldBeAnalyzedForSolidColor() const;
- bool RetainsIndividualDisplayItems() const;
-
std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue(
bool include_items) const;
@@ -108,6 +97,10 @@ class CC_EXPORT DisplayItemList
float raster_scale,
std::vector<DrawImage>* images);
+ void SetRetainVisualRectsForTesting(bool retain) {
+ retain_visual_rects_ = retain;
+ }
+
gfx::Rect VisualRectForTesting(int index) {
return inputs_.visual_rects[index];
}
@@ -121,27 +114,23 @@ class CC_EXPORT DisplayItemList
}
private:
- DisplayItemList(gfx::Rect layer_rect,
- const DisplayItemListSettings& display_list_settings,
- bool retain_individual_display_items);
+ explicit DisplayItemList(
+ const DisplayItemListSettings& display_list_settings);
~DisplayItemList();
void ProcessAppendedItem(const DisplayItem* item);
- sk_sp<SkPicture> picture_;
-
- std::unique_ptr<SkPictureRecorder> recorder_;
-
- bool retain_individual_display_items_;
- int approximate_op_count_;
+ RTree rtree_;
+ // For testing purposes only. Whether to keep visual rects across calls to
+ // Finalize().
+ bool retain_visual_rects_ = false;
- // Memory usage due to the cached SkPicture.
- size_t picture_memory_usage_;
+ int approximate_op_count_ = 0;
DiscardableImageMap image_map_;
struct Inputs {
- Inputs(gfx::Rect layer_rect, const DisplayItemListSettings& settings);
+ explicit Inputs(const DisplayItemListSettings& settings);
~Inputs();
ContiguousContainer<DisplayItem> items;
@@ -153,8 +142,7 @@ class CC_EXPORT DisplayItemList
std::vector<gfx::Rect> visual_rects;
const DisplayItemListSettings settings;
- gfx::Rect layer_rect;
- bool is_suitable_for_gpu_rasterization;
+ bool all_items_are_suitable_for_gpu_rasterization = true;
};
Inputs inputs_;

Powered by Google App Engine
This is Rietveld 408576698