| 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 "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/geometry/IntRect.h" | 10 #include "platform/geometry/IntRect.h" |
| 11 #include "platform/geometry/LayoutPoint.h" | 11 #include "platform/geometry/LayoutPoint.h" |
| 12 #include "platform/graphics/ContiguousContainer.h" | 12 #include "platform/graphics/ContiguousContainer.h" |
| 13 #include "platform/graphics/paint/DisplayItem.h" | 13 #include "platform/graphics/paint/DisplayItem.h" |
| 14 #include "platform/graphics/paint/DisplayItemList.h" | 14 #include "platform/graphics/paint/DisplayItemList.h" |
| 15 #include "platform/graphics/paint/PaintArtifact.h" | 15 #include "platform/graphics/paint/PaintArtifact.h" |
| 16 #include "platform/graphics/paint/PaintChunk.h" | 16 #include "platform/graphics/paint/PaintChunk.h" |
| 17 #include "platform/graphics/paint/PaintChunker.h" | 17 #include "platform/graphics/paint/PaintChunker.h" |
| 18 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 18 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 19 #include "wtf/Alignment.h" | 19 #include "wtf/Alignment.h" |
| 20 #include "wtf/Assertions.h" | 20 #include "wtf/Assertions.h" |
| 21 #include "wtf/HashMap.h" | 21 #include "wtf/HashMap.h" |
| 22 #include "wtf/HashSet.h" | 22 #include "wtf/HashSet.h" |
| 23 #include "wtf/PassOwnPtr.h" | 23 #include "wtf/PassOwnPtr.h" |
| 24 #include "wtf/Vector.h" | 24 #include "wtf/Vector.h" |
| 25 #include <utility> | 25 #include <utility> |
| 26 | 26 |
| 27 class SkPicture; |
| 28 |
| 27 namespace blink { | 29 namespace blink { |
| 28 | 30 |
| 29 class GraphicsContext; | 31 class GraphicsContext; |
| 30 | 32 |
| 31 static const size_t kInitialDisplayItemListCapacityBytes = 512; | 33 static const size_t kInitialDisplayItemListCapacityBytes = 512; |
| 32 | 34 |
| 33 // Responsible for processing display items as they are produced, and producing | 35 // Responsible for processing display items as they are produced, and producing |
| 34 // a final paint artifact when complete. This class includes logic for caching, | 36 // a final paint artifact when complete. This class includes logic for caching, |
| 35 // cache invalidation, and merging. | 37 // cache invalidation, and merging. |
| 36 class PLATFORM_EXPORT PaintController { | 38 class PLATFORM_EXPORT PaintController { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 134 |
| 133 bool textPainted() const { return m_textPainted; } | 135 bool textPainted() const { return m_textPainted; } |
| 134 void setTextPainted() { m_textPainted = true; } | 136 void setTextPainted() { m_textPainted = true; } |
| 135 bool imagePainted() const { return m_imagePainted; } | 137 bool imagePainted() const { return m_imagePainted; } |
| 136 void setImagePainted() { m_imagePainted = true; } | 138 void setImagePainted() { m_imagePainted = true; } |
| 137 | 139 |
| 138 // Returns displayItemList added using createAndAppend() since beginning or | 140 // Returns displayItemList added using createAndAppend() since beginning or |
| 139 // the last commitNewDisplayItems(). Use with care. | 141 // the last commitNewDisplayItems(). Use with care. |
| 140 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } | 142 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } |
| 141 | 143 |
| 144 void appendDebugDrawingAfterCommit(const DisplayItemClient&, PassRefPtr<SkPi
cture>, const LayoutSize& offsetFromLayoutObject); |
| 145 |
| 142 #ifndef NDEBUG | 146 #ifndef NDEBUG |
| 143 void showDebugData() const; | 147 void showDebugData() const; |
| 144 #endif | 148 #endif |
| 145 | 149 |
| 146 // This is called only if we are tracking paint invalidation for testing, or
DCHECK_IS_ON() | 150 // This is called only if we are tracking paint invalidation for testing, or
DCHECK_IS_ON() |
| 147 // for error checking and debugging. | 151 // for error checking and debugging. |
| 148 void displayItemClientWasInvalidated(const DisplayItemClient&); | 152 void displayItemClientWasInvalidated(const DisplayItemClient&); |
| 149 | 153 |
| 150 #if DCHECK_IS_ON() | 154 #if DCHECK_IS_ON() |
| 151 bool hasInvalidations() { return !m_invalidations.isEmpty(); } | 155 bool hasInvalidations() { return !m_invalidations.isEmpty(); } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 struct OutOfOrderIndexContext; | 188 struct OutOfOrderIndexContext; |
| 185 DisplayItemList::iterator findOutOfOrderCachedItem(const DisplayItem::Id&, O
utOfOrderIndexContext&); | 189 DisplayItemList::iterator findOutOfOrderCachedItem(const DisplayItem::Id&, O
utOfOrderIndexContext&); |
| 186 DisplayItemList::iterator findOutOfOrderCachedItemForward(const DisplayItem:
:Id&, OutOfOrderIndexContext&); | 190 DisplayItemList::iterator findOutOfOrderCachedItemForward(const DisplayItem:
:Id&, OutOfOrderIndexContext&); |
| 187 void copyCachedSubsequence(const DisplayItemList& currentList, DisplayItemLi
st::iterator& currentIt, DisplayItemList& updatedList, SkPictureGpuAnalyzer&); | 191 void copyCachedSubsequence(const DisplayItemList& currentList, DisplayItemLi
st::iterator& currentIt, DisplayItemList& updatedList, SkPictureGpuAnalyzer&); |
| 188 | 192 |
| 189 #if DCHECK_IS_ON() | 193 #if DCHECK_IS_ON() |
| 190 // The following two methods are for checking under-invalidations | 194 // The following two methods are for checking under-invalidations |
| 191 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl
ed). | 195 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl
ed). |
| 192 void checkUnderInvalidation(DisplayItemList::iterator& newIt, DisplayItemLis
t::iterator& currentIt); | 196 void checkUnderInvalidation(DisplayItemList::iterator& newIt, DisplayItemLis
t::iterator& currentIt); |
| 193 void checkCachedDisplayItemIsUnchanged(const char* messagePrefix, const Disp
layItem& newItem, const DisplayItem& oldItem); | 197 void checkCachedDisplayItemIsUnchanged(const char* messagePrefix, const Disp
layItem& newItem, const DisplayItem& oldItem); |
| 194 void checkNoRemainingCachedDisplayItems(); | |
| 195 #endif | 198 #endif |
| 196 | 199 |
| 197 void updateCacheGeneration(); | 200 void updateCacheGeneration(); |
| 198 | 201 |
| 199 // The last complete paint artifact. | 202 // The last complete paint artifact. |
| 200 // In SPv2, this includes paint chunks as well as display items. | 203 // In SPv2, this includes paint chunks as well as display items. |
| 201 PaintArtifact m_currentPaintArtifact; | 204 PaintArtifact m_currentPaintArtifact; |
| 202 | 205 |
| 203 // Data being used to build the next paint artifact. | 206 // Data being used to build the next paint artifact. |
| 204 DisplayItemList m_newDisplayItemList; | 207 DisplayItemList m_newDisplayItemList; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 234 // easily find where the duplicated ids are from. | 237 // easily find where the duplicated ids are from. |
| 235 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 238 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 236 #endif | 239 #endif |
| 237 | 240 |
| 238 DisplayItemCacheGeneration m_currentCacheGeneration; | 241 DisplayItemCacheGeneration m_currentCacheGeneration; |
| 239 }; | 242 }; |
| 240 | 243 |
| 241 } // namespace blink | 244 } // namespace blink |
| 242 | 245 |
| 243 #endif // PaintController_h | 246 #endif // PaintController_h |
| OLD | NEW |