| 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>, | 187 const FloatRect& record_bounds); |
| 191 const FloatRect& record_bounds, | |
| 192 const LayoutSize& offset_from_layout_object); | |
| 193 | 188 |
| 194 void ShowDebugData() const { ShowDebugDataInternal(false); } | 189 void ShowDebugData() const { ShowDebugDataInternal(false); } |
| 195 #ifndef NDEBUG | 190 #ifndef NDEBUG |
| 196 void ShowDebugDataWithRecords() const { ShowDebugDataInternal(true); } | 191 void ShowDebugDataWithRecords() const { ShowDebugDataInternal(true); } |
| 197 #endif | 192 #endif |
| 198 | 193 |
| 199 #if DCHECK_IS_ON() | 194 #if DCHECK_IS_ON() |
| 200 void AssertDisplayItemClientsAreLive(); | 195 void AssertDisplayItemClientsAreLive(); |
| 201 | 196 |
| 202 enum Usage { kForNormalUsage, kForPaintRecordBuilder }; | 197 enum Usage { kForNormalUsage, kForPaintRecordBuilder }; |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 CachedSubsequenceMap new_cached_subsequences_; | 445 CachedSubsequenceMap new_cached_subsequences_; |
| 451 size_t last_cached_subsequence_end_; | 446 size_t last_cached_subsequence_end_; |
| 452 | 447 |
| 453 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); | 448 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); |
| 454 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); | 449 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); |
| 455 }; | 450 }; |
| 456 | 451 |
| 457 } // namespace blink | 452 } // namespace blink |
| 458 | 453 |
| 459 #endif // PaintController_h | 454 #endif // PaintController_h |
| OLD | NEW |