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

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: Sync to head and flip for LayoutInline. Created 4 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 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 6660f363267ffbb17bbbb48efe5410f046d69552..eebd737d7cbd2d48e163334b61600258f5787f56 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.
@@ -64,11 +61,6 @@ class CC_EXPORT DisplayItemList
const gfx::Rect& canvas_target_playback_rect,
float contents_scale) 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.
@@ -79,7 +71,6 @@ class CC_EXPORT DisplayItemList
auto* item = &items_.AllocateAndConstruct<DisplayItemType>(
std::forward<Args>(args)...);
approximate_op_count_ += item->ApproximateOpCount();
- ProcessAppendedItem(item);
return *item;
}
@@ -88,15 +79,13 @@ class CC_EXPORT DisplayItemList
void Finalize();
void SetIsSuitableForGpuRasterization(bool is_suitable) {
- is_suitable_for_gpu_rasterization_ = is_suitable;
+ 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,15 +97,20 @@ class CC_EXPORT DisplayItemList
std::vector<DrawImage>* images);
gfx::Rect VisualRectForTesting(int index) { return visual_rects_[index]; }
+ void SetRetainVisualRectsForTesting(bool retain) {
+ retain_visual_rects_ = retain;
+ }
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);
+ gfx::Rect GetQueryRect(const gfx::Rect& rect, float scale) const;
+
+ RTree rtree_;
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
@@ -124,19 +118,12 @@ class CC_EXPORT DisplayItemList
// |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_;
+ bool retain_visual_rects_;
vmpstr 2016/06/22 20:14:07 Where are we using this?
wkorman 2016/06/24 19:57:14 In display_item_list_unittest, two main cases: 1.
vmpstr 2016/06/24 20:15:33 Can you put a comment to make it clear that this i
wkorman 2016/06/24 22:39:32 Done.
- std::unique_ptr<SkPictureRecorder> recorder_;
const DisplayItemListSettings settings_;
- bool retain_individual_display_items_;
-
- gfx::Rect layer_rect_;
- bool is_suitable_for_gpu_rasterization_;
+ bool all_items_are_suitable_for_gpu_rasterization_;
int approximate_op_count_;
- // Memory usage due to the cached SkPicture.
- size_t picture_memory_usage_;
-
DiscardableImageMap image_map_;
friend class base::RefCountedThreadSafe<DisplayItemList>;

Powered by Google App Engine
This is Rietveld 408576698