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