Chromium Code Reviews| 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..aecfbeb3fdf8f32a2ce195ea71722d6beaf69c67 100644 |
| --- a/cc/playback/display_item_list.h |
| +++ b/cc/playback/display_item_list.h |
| @@ -22,6 +22,8 @@ class SkCanvas; |
| class SkPictureRecorder; |
| namespace cc { |
| +class DisplayItem; |
| +class DrawingDisplayItem; |
| namespace proto { |
| class DisplayItemList; |
| @@ -60,21 +62,21 @@ class CC_EXPORT DisplayItemList |
| // 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; |
| -#endif |
| + // 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. |
| + template <typename DisplayItemType, typename... Args> |
| + const DisplayItemType& CreateAndAppendItem(const gfx::Rect& visual_rect, |
| + const Args&... args) { |
| visual_rects_.push_back(visual_rect); |
| - ProcessAppendedItemsOnTheFly(); |
| - return &items_.AllocateAndConstruct<DisplayItemType>(); |
| + // TODO(enne): This should forward the args. |
|
danakj
2015/12/08 19:18:16
I'll work on allowing forward soon, now that you c
|
| + auto* item = &items_.AllocateAndConstruct<DisplayItemType>(args...); |
| + approximate_op_count_ += item->ApproximateOpCount(); |
| + is_suitable_for_gpu_rasterization_ &= item->IsSuitableForGpuRasterization(); |
| + ProcessAppendedItem(item); |
| + return *item; |
| } |
| - // Removes the last item. This cannot be called on lists with cached pictures |
| - // (since the data may already have been incorporated into cached picture |
| - // sizes, etc). |
| - void RemoveLast(); |
| - |
| // Called after all items are appended, to process the items and, if |
| // applicable, create an internally cached SkPicture. |
| void Finalize(); |
| @@ -104,16 +106,7 @@ class CC_EXPORT DisplayItemList |
| bool retain_individual_display_items); |
| ~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_; |
| -#else |
| - bool ProcessAppendedItemsCalled() const { return true; } |
| -#endif |
| + void ProcessAppendedItem(const DisplayItem* item); |
| ContiguousContainer<DisplayItem> items_; |
| // The visual rects associated with each of the display items in the |
| @@ -136,9 +129,6 @@ class CC_EXPORT DisplayItemList |
| // 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_; |
| - |
| DiscardableImageMap image_map_; |
| friend class base::RefCountedThreadSafe<DisplayItemList>; |