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

Side by Side Diff: cc/playback/display_item_list.h

Issue 1423653005: Further plumb visual rect into cc:DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clip recorder params in omnibox. 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 unified diff | Download patch
« no previous file with comments | « cc/playback/display_item.h ('k') | cc/playback/display_item_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SkPicture::AbortCallback* callback, 54 SkPicture::AbortCallback* callback,
55 const gfx::Rect& canvas_target_playback_rect, 55 const gfx::Rect& canvas_target_playback_rect,
56 float contents_scale) const; 56 float contents_scale) const;
57 57
58 // This is a fast path for use only if canvas_ is set and 58 // This is a fast path for use only if canvas_ is set and
59 // retain_individual_display_items_ is false. This method also updates 59 // retain_individual_display_items_ is false. This method also updates
60 // is_suitable_for_gpu_rasterization_ and approximate_op_count_. 60 // is_suitable_for_gpu_rasterization_ and approximate_op_count_.
61 void RasterIntoCanvas(const DisplayItem& display_item); 61 void RasterIntoCanvas(const DisplayItem& display_item);
62 62
63 template <typename DisplayItemType> 63 template <typename DisplayItemType>
64 DisplayItemType* CreateAndAppendItem() { 64 DisplayItemType* CreateAndAppendItem(const gfx::Rect& visual_rect) {
65 #if DCHECK_IS_ON() 65 #if DCHECK_IS_ON()
66 needs_process_ = true; 66 needs_process_ = true;
67 #endif 67 #endif
68 visual_rects_.push_back(visual_rect);
68 ProcessAppendedItemsOnTheFly(); 69 ProcessAppendedItemsOnTheFly();
69 return items_.AllocateAndConstruct<DisplayItemType>(); 70 return items_.AllocateAndConstruct<DisplayItemType>();
70 } 71 }
71 72
72 // Removes the last item. This cannot be called on lists with cached pictures 73 // Removes the last item. This cannot be called on lists with cached pictures
73 // (since the data may already have been incorporated into cached picture 74 // (since the data may already have been incorporated into cached picture
74 // sizes, etc). 75 // sizes, etc).
75 void RemoveLast(); 76 void RemoveLast();
76 77
77 // Called after all items are appended, to process the items and, if 78 // Called after all items are appended, to process the items and, if
(...skipping 10 matching lines...) Expand all
88 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue( 89 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue(
89 bool include_items) const; 90 bool include_items) const;
90 91
91 void EmitTraceSnapshot() const; 92 void EmitTraceSnapshot() const;
92 93
93 void GenerateDiscardableImagesMetadata(); 94 void GenerateDiscardableImagesMetadata();
94 void GetDiscardableImagesInRect(const gfx::Rect& rect, 95 void GetDiscardableImagesInRect(const gfx::Rect& rect,
95 float raster_scale, 96 float raster_scale,
96 std::vector<DrawImage>* images); 97 std::vector<DrawImage>* images);
97 98
99 gfx::Rect VisualRectForTesting(int index) { return visual_rects_[index]; }
100
98 private: 101 private:
99 DisplayItemList(gfx::Rect layer_rect, 102 DisplayItemList(gfx::Rect layer_rect,
100 const DisplayItemListSettings& display_list_settings, 103 const DisplayItemListSettings& display_list_settings,
101 bool retain_individual_display_items); 104 bool retain_individual_display_items);
102 ~DisplayItemList(); 105 ~DisplayItemList();
103 106
104 // While appending new items, if they are not being retained, this can process 107 // While appending new items, if they are not being retained, this can process
105 // periodically to avoid retaining all the items and processing at the end. 108 // periodically to avoid retaining all the items and processing at the end.
106 void ProcessAppendedItemsOnTheFly(); 109 void ProcessAppendedItemsOnTheFly();
107 void ProcessAppendedItems(); 110 void ProcessAppendedItems();
108 #if DCHECK_IS_ON() 111 #if DCHECK_IS_ON()
109 bool ProcessAppendedItemsCalled() const { return !needs_process_; } 112 bool ProcessAppendedItemsCalled() const { return !needs_process_; }
110 bool needs_process_; 113 bool needs_process_;
111 #else 114 #else
112 bool ProcessAppendedItemsCalled() const { return true; } 115 bool ProcessAppendedItemsCalled() const { return true; }
113 #endif 116 #endif
114 117
115 ListContainer<DisplayItem> items_; 118 ListContainer<DisplayItem> items_;
119 // The visual rects associated with each of the display items in the
120 // display item list. There is one rect per display item, and the
121 // position in |visual_rects_| matches the position of the item in
122 // |items_| . These rects are intentionally kept separate
123 // because they are not needed while walking the |items_| for raster.
124 std::vector<gfx::Rect> visual_rects_;
116 skia::RefPtr<SkPicture> picture_; 125 skia::RefPtr<SkPicture> picture_;
117 126
118 scoped_ptr<SkPictureRecorder> recorder_; 127 scoped_ptr<SkPictureRecorder> recorder_;
119 skia::RefPtr<SkCanvas> canvas_; 128 skia::RefPtr<SkCanvas> canvas_;
120 const DisplayItemListSettings settings_; 129 const DisplayItemListSettings settings_;
121 bool retain_individual_display_items_; 130 bool retain_individual_display_items_;
122 131
123 gfx::Rect layer_rect_; 132 gfx::Rect layer_rect_;
124 bool is_suitable_for_gpu_rasterization_; 133 bool is_suitable_for_gpu_rasterization_;
125 int approximate_op_count_; 134 int approximate_op_count_;
126 135
127 // Memory usage due to the cached SkPicture. 136 // Memory usage due to the cached SkPicture.
128 size_t picture_memory_usage_; 137 size_t picture_memory_usage_;
129 138
130 // Memory usage due to external data held by display items. 139 // Memory usage due to external data held by display items.
131 size_t external_memory_usage_; 140 size_t external_memory_usage_;
132 141
133 DiscardableImageMap image_map_; 142 DiscardableImageMap image_map_;
134 143
135 friend class base::RefCountedThreadSafe<DisplayItemList>; 144 friend class base::RefCountedThreadSafe<DisplayItemList>;
136 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage); 145 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage);
137 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); 146 DISALLOW_COPY_AND_ASSIGN(DisplayItemList);
138 }; 147 };
139 148
140 } // namespace cc 149 } // namespace cc
141 150
142 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ 151 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_
OLDNEW
« no previous file with comments | « cc/playback/display_item.h ('k') | cc/playback/display_item_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698