OLD | NEW |
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 PaintController_h | 5 #ifndef PaintController_h |
6 #define PaintController_h | 6 #define PaintController_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void RemoveLastDisplayItem(); | 133 void RemoveLastDisplayItem(); |
134 const DisplayItem* LastDisplayItem(unsigned offset); | 134 const DisplayItem* LastDisplayItem(unsigned offset); |
135 | 135 |
136 void BeginSkippingCache() { ++skipping_cache_count_; } | 136 void BeginSkippingCache() { ++skipping_cache_count_; } |
137 void EndSkippingCache() { | 137 void EndSkippingCache() { |
138 DCHECK(skipping_cache_count_ > 0); | 138 DCHECK(skipping_cache_count_ > 0); |
139 --skipping_cache_count_; | 139 --skipping_cache_count_; |
140 } | 140 } |
141 bool IsSkippingCache() const { return skipping_cache_count_; } | 141 bool IsSkippingCache() const { return skipping_cache_count_; } |
142 | 142 |
143 // Must be called when a painting is finished. |offsetFromLayoutObject| is the | 143 // Must be called when a painting is finished. |
144 // offset between the space of the GraphicsLayer which owns this | 144 void CommitNewDisplayItems(); |
145 // PaintController and the coordinate space of the owning LayoutObject. | |
146 void CommitNewDisplayItems( | |
147 const LayoutSize& offset_from_layout_object = LayoutSize()); | |
148 | 145 |
149 // Returns the approximate memory usage, excluding memory likely to be | 146 // Returns the approximate memory usage, excluding memory likely to be |
150 // shared with the embedder after copying to WebPaintController. | 147 // shared with the embedder after copying to WebPaintController. |
151 // Should only be called right after commitNewDisplayItems. | 148 // Should only be called right after commitNewDisplayItems. |
152 size_t ApproximateUnsharedMemoryUsage() const; | 149 size_t ApproximateUnsharedMemoryUsage() const; |
153 | 150 |
154 // Get the artifact generated after the last commit. | 151 // Get the artifact generated after the last commit. |
155 const PaintArtifact& GetPaintArtifact() const; | 152 const PaintArtifact& GetPaintArtifact() const; |
156 const DisplayItemList& GetDisplayItemList() const { | 153 const DisplayItemList& GetDisplayItemList() const { |
157 return GetPaintArtifact().GetDisplayItemList(); | 154 return GetPaintArtifact().GetDisplayItemList(); |
(...skipping 20 matching lines...) Expand all Loading... |
178 } | 175 } |
179 | 176 |
180 void SetFirstPainted(); | 177 void SetFirstPainted(); |
181 void SetTextPainted(); | 178 void SetTextPainted(); |
182 void SetImagePainted(); | 179 void SetImagePainted(); |
183 | 180 |
184 // Returns displayItemList added using createAndAppend() since beginning or | 181 // Returns displayItemList added using createAndAppend() since beginning or |
185 // the last commitNewDisplayItems(). Use with care. | 182 // the last commitNewDisplayItems(). Use with care. |
186 DisplayItemList& NewDisplayItemList() { return new_display_item_list_; } | 183 DisplayItemList& NewDisplayItemList() { return new_display_item_list_; } |
187 | 184 |
188 void AppendDebugDrawingAfterCommit( | 185 void AppendDebugDrawingAfterCommit(const DisplayItemClient&, |
189 const DisplayItemClient&, | 186 sk_sp<PaintRecord>); |
190 sk_sp<PaintRecord>, | |
191 const LayoutSize& offset_from_layout_object); | |
192 | 187 |
193 void ShowDebugData() const { ShowDebugDataInternal(false); } | 188 void ShowDebugData() const { ShowDebugDataInternal(false); } |
194 #ifndef NDEBUG | 189 #ifndef NDEBUG |
195 void ShowDebugDataWithRecords() const { ShowDebugDataInternal(true); } | 190 void ShowDebugDataWithRecords() const { ShowDebugDataInternal(true); } |
196 #endif | 191 #endif |
197 | 192 |
198 #if DCHECK_IS_ON() | 193 #if DCHECK_IS_ON() |
199 void AssertDisplayItemClientsAreLive(); | 194 void AssertDisplayItemClientsAreLive(); |
200 | 195 |
201 enum Usage { kForNormalUsage, kForPaintRecordBuilder }; | 196 enum Usage { kForNormalUsage, kForPaintRecordBuilder }; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 CachedSubsequenceMap new_cached_subsequences_; | 444 CachedSubsequenceMap new_cached_subsequences_; |
450 size_t last_cached_subsequence_end_; | 445 size_t last_cached_subsequence_end_; |
451 | 446 |
452 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); | 447 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); |
453 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); | 448 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); |
454 }; | 449 }; |
455 | 450 |
456 } // namespace blink | 451 } // namespace blink |
457 | 452 |
458 #endif // PaintController_h | 453 #endif // PaintController_h |
OLD | NEW |