| Index: cc/playback/display_item_list.h
|
| diff --git a/cc/playback/display_item_list.h b/cc/playback/display_item_list.h
|
| index 83ad4f43de24ccac48a1f5624b3d794e3a1876fc..fcc936f17ed90338a69d28d3ea356abebfa7ef98 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,10 +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 these CreateAndAppend functions, all the set
|
| // up for the item should be done via the args, which is why the return type
|
| @@ -148,15 +141,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;
|
|
|
| @@ -167,6 +158,10 @@ class CC_EXPORT DisplayItemList
|
| float raster_scale,
|
| std::vector<DrawImage>* images);
|
|
|
| + void SetRetainVisualRectsForTesting(bool retain) {
|
| + retain_visual_rects_ = retain;
|
| + }
|
| +
|
| size_t size() const { return inputs_.items.size(); }
|
|
|
| gfx::Rect VisualRectForTesting(int index) {
|
| @@ -182,39 +177,33 @@ 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();
|
|
|
| + RTree rtree_;
|
| + // For testing purposes only. Whether to keep visual rects across calls to
|
| + // Finalize().
|
| + bool retain_visual_rects_ = false;
|
| +
|
| // If we're currently within a paired display item block, unions the
|
| // given visual rect with the begin display item's visual rect.
|
| void GrowCurrentBeginItemVisualRect(const gfx::Rect& visual_rect);
|
| - void ProcessAppendedItem(const DisplayItem* item);
|
|
|
| template <typename DisplayItemType, typename... Args>
|
| const DisplayItemType& AllocateAndConstruct(Args&&... args) {
|
| auto* item = &inputs_.items.AllocateAndConstruct<DisplayItemType>(
|
| std::forward<Args>(args)...);
|
| approximate_op_count_ += item->ApproximateOpCount();
|
| - ProcessAppendedItem(item);
|
| return *item;
|
| }
|
|
|
| - sk_sp<SkPicture> picture_;
|
| -
|
| - std::unique_ptr<SkPictureRecorder> recorder_;
|
| -
|
| - bool retain_individual_display_items_;
|
| - int approximate_op_count_;
|
| -
|
| - // 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;
|
| @@ -226,8 +215,7 @@ class CC_EXPORT DisplayItemList
|
| std::vector<gfx::Rect> visual_rects;
|
| std::vector<size_t> begin_item_indices;
|
| const DisplayItemListSettings settings;
|
| - gfx::Rect layer_rect;
|
| - bool is_suitable_for_gpu_rasterization;
|
| + bool all_items_are_suitable_for_gpu_rasterization = true;
|
| };
|
|
|
| Inputs inputs_;
|
|
|