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

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. Created 5 years 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 4d245383f40944554310348344d11640c8853bc6..acb1303e1ab52fda52a02a8b154e20b88694a4b2 100644
--- a/cc/playback/display_item_list.h
+++ b/cc/playback/display_item_list.h
@@ -11,12 +11,14 @@
#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 "skia/ext/refptr.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;
@@ -30,13 +32,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.
@@ -55,18 +52,14 @@ 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
- // is_suitable_for_gpu_rasterization_ and approximate_op_count_.
- void RasterIntoCanvas(const DisplayItem& display_item);
-
template <typename DisplayItemType>
DisplayItemType* CreateAndAppendItem(const gfx::Rect& visual_rect) {
#if DCHECK_IS_ON()
- needs_process_ = true;
+ needs_finalize_ = true;
#endif
+ // TODO(wkorman): Would be nice to avoid having to do this conversion if
+ // possible.
visual_rects_.push_back(visual_rect);
- ProcessAppendedItemsOnTheFly();
return &items_.AllocateAndConstruct<DisplayItemType>();
}
@@ -84,8 +77,6 @@ class CC_EXPORT DisplayItemList
size_t ApproximateMemoryUsage() const;
bool ShouldBeAnalyzedForSolidColor() const;
- bool RetainsIndividualDisplayItems() const;
-
scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue(
bool include_items) const;
@@ -96,25 +87,25 @@ 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 visual_rects_[index];
+ }
private:
- DisplayItemList(gfx::Rect layer_rect,
- const DisplayItemListSettings& display_list_settings,
- bool retain_individual_display_items);
+ explicit DisplayItemList(
+ const DisplayItemListSettings& display_list_settings);
~DisplayItemList();
- // While appending new items, if they are not being retained, this can process
- // periodically to avoid retaining all the items and processing at the end.
- void ProcessAppendedItemsOnTheFly();
- void ProcessAppendedItems();
#if DCHECK_IS_ON()
- bool ProcessAppendedItemsCalled() const { return !needs_process_; }
- bool needs_process_;
+ bool FinalizeCalled() const { return !needs_finalize_; }
+ bool needs_finalize_;
#else
- bool ProcessAppendedItemsCalled() const { return true; }
+ bool FinalizeCalled() const { return true; }
#endif
+ 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,18 +115,10 @@ class CC_EXPORT DisplayItemList
std::vector<gfx::Rect> visual_rects_;
skia::RefPtr<SkPicture> picture_;
- scoped_ptr<SkPictureRecorder> recorder_;
- skia::RefPtr<SkCanvas> canvas_;
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_;
-
// Memory usage due to external data held by display items.
size_t external_memory_usage_;

Powered by Google App Engine
This is Rietveld 408576698