| 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" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 protected: | 158 protected: |
| 159 PaintController() | 159 PaintController() |
| 160 : m_newDisplayItemList(0) | 160 : m_newDisplayItemList(0) |
| 161 , m_constructionDisabled(false) | 161 , m_constructionDisabled(false) |
| 162 , m_subsequenceCachingDisabled(false) | 162 , m_subsequenceCachingDisabled(false) |
| 163 , m_textPainted(false) | 163 , m_textPainted(false) |
| 164 , m_imagePainted(false) | 164 , m_imagePainted(false) |
| 165 , m_skippingCacheCount(0) | 165 , m_skippingCacheCount(0) |
| 166 , m_numCachedNewItems(0) | 166 , m_numCachedNewItems(0) |
| 167 , m_currentChunkIsFromCachedSubsequence(true) | 167 , m_currentChunkIsFromCachedSubsequence(true) |
| 168 #ifndef NDEBUG | 168 #if DCHECK_IS_ON() |
| 169 , m_numSequentialMatches(0) | 169 , m_numSequentialMatches(0) |
| 170 , m_numOutOfOrderMatches(0) | 170 , m_numOutOfOrderMatches(0) |
| 171 , m_numIndexedItems(0) | 171 , m_numIndexedItems(0) |
| 172 #endif | 172 #endif |
| 173 { | 173 { |
| 174 resetCurrentListIndices(); | 174 resetCurrentListIndices(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 friend class PaintControllerTestBase; | 178 friend class PaintControllerTestBase; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 203 void copyCachedSubsequence(size_t&); | 203 void copyCachedSubsequence(size_t&); |
| 204 | 204 |
| 205 // Resets the indices (e.g. m_nextItemToMatch) of m_currentPaintArtifact.get
DisplayItemList() | 205 // Resets the indices (e.g. m_nextItemToMatch) of m_currentPaintArtifact.get
DisplayItemList() |
| 206 // to their initial values. This should be called when the DisplayItemList i
n m_currentPaintArtifact | 206 // to their initial values. This should be called when the DisplayItemList i
n m_currentPaintArtifact |
| 207 // is newly created, or is changed causing the previous indices to be invali
d. | 207 // is newly created, or is changed causing the previous indices to be invali
d. |
| 208 void resetCurrentListIndices(); | 208 void resetCurrentListIndices(); |
| 209 | 209 |
| 210 void generateChunkRasterInvalidationRects(PaintChunk& newChunk); | 210 void generateChunkRasterInvalidationRects(PaintChunk& newChunk); |
| 211 void generateChunkRasterInvalidationRectsComparingOldChunk(PaintChunk& newCh
unk, const PaintChunk& oldChunk); | 211 void generateChunkRasterInvalidationRectsComparingOldChunk(PaintChunk& newCh
unk, const PaintChunk& oldChunk); |
| 212 | 212 |
| 213 #if DCHECK_IS_ON() |
| 213 // The following two methods are for checking under-invalidations | 214 // The following two methods are for checking under-invalidations |
| 214 // (when RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled). | 215 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl
ed). |
| 215 void showUnderInvalidationError(const char* reason, const DisplayItem& newIt
em, const DisplayItem* oldItem) const; | 216 void showUnderInvalidationError(const char* reason, const DisplayItem& newIt
em, const DisplayItem* oldItem) const; |
| 216 void checkUnderInvalidation(); | 217 void checkUnderInvalidation(); |
| 217 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin
gEnd - m_underInvalidationCheckingBegin > 0; } | 218 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin
gEnd - m_underInvalidationCheckingBegin > 0; } |
| 219 #endif |
| 218 | 220 |
| 219 // The last complete paint artifact. | 221 // The last complete paint artifact. |
| 220 // In SPv2, this includes paint chunks as well as display items. | 222 // In SPv2, this includes paint chunks as well as display items. |
| 221 PaintArtifact m_currentPaintArtifact; | 223 PaintArtifact m_currentPaintArtifact; |
| 222 | 224 |
| 223 // Data being used to build the next paint artifact. | 225 // Data being used to build the next paint artifact. |
| 224 DisplayItemList m_newDisplayItemList; | 226 DisplayItemList m_newDisplayItemList; |
| 225 PaintChunker m_newPaintChunks; | 227 PaintChunker m_newPaintChunks; |
| 226 | 228 |
| 227 // Allow display item construction to be disabled to isolate the costs of co
nstruction | 229 // Allow display item construction to be disabled to isolate the costs of co
nstruction |
| (...skipping 29 matching lines...) Expand all Loading... |
| 257 // Similar to m_outOfOrderItemIndices but | 259 // Similar to m_outOfOrderItemIndices but |
| 258 // - the indices are chunk indices in m_currentPaintArtifacts.paintChunks(); | 260 // - the indices are chunk indices in m_currentPaintArtifacts.paintChunks(); |
| 259 // - chunks are matched not only for requests of cached display items, but a
lso non-cached display items. | 261 // - chunks are matched not only for requests of cached display items, but a
lso non-cached display items. |
| 260 IndicesByClientMap m_outOfOrderChunkIndices; | 262 IndicesByClientMap m_outOfOrderChunkIndices; |
| 261 | 263 |
| 262 bool m_currentChunkIsFromCachedSubsequence; | 264 bool m_currentChunkIsFromCachedSubsequence; |
| 263 size_t m_nextChunkToMatch; | 265 size_t m_nextChunkToMatch; |
| 264 | 266 |
| 265 DisplayItemClient::CacheGenerationOrInvalidationReason m_currentCacheGenerat
ion; | 267 DisplayItemClient::CacheGenerationOrInvalidationReason m_currentCacheGenerat
ion; |
| 266 | 268 |
| 267 #ifndef NDEBUG | 269 #if DCHECK_IS_ON() |
| 268 int m_numSequentialMatches; | 270 int m_numSequentialMatches; |
| 269 int m_numOutOfOrderMatches; | 271 int m_numOutOfOrderMatches; |
| 270 int m_numIndexedItems; | 272 int m_numIndexedItems; |
| 271 #endif | |
| 272 | 273 |
| 273 #if DCHECK_IS_ON() | |
| 274 // This is used to check duplicated ids during createAndAppend(). | 274 // This is used to check duplicated ids during createAndAppend(). |
| 275 IndicesByClientMap m_newDisplayItemIndicesByClient; | 275 IndicesByClientMap m_newDisplayItemIndicesByClient; |
| 276 #endif | |
| 277 | 276 |
| 278 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP
ossible() | 277 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP
ossible() |
| 279 // when we could use cached drawing or subsequence and under-invalidation ch
ecking is on, | 278 // when we could use cached drawing or subsequence and under-invalidation ch
ecking is on, |
| 280 // indicating the begin and end of the cached drawing or subsequence in the
current list. | 279 // indicating the begin and end of the cached drawing or subsequence in the
current list. |
| 281 // The functions return false to let the client do actual painting, and Pain
tController | 280 // The functions return false to let the client do actual painting, and Pain
tController |
| 282 // will check if the actual painting results are the same as the cached. | 281 // will check if the actual painting results are the same as the cached. |
| 283 size_t m_underInvalidationCheckingBegin; | 282 size_t m_underInvalidationCheckingBegin; |
| 284 size_t m_underInvalidationCheckingEnd; | 283 size_t m_underInvalidationCheckingEnd; |
| 285 // Number of probable under-invalidations that have been skipped temporarily
because the | 284 // Number of probable under-invalidations that have been skipped temporarily
because the |
| 286 // mismatching display items may be removed in the future because of no-op p
airs or | 285 // mismatching display items may be removed in the future because of no-op p
airs or |
| 287 // compositing folding. | 286 // compositing folding. |
| 288 int m_skippedProbableUnderInvalidationCount; | 287 int m_skippedProbableUnderInvalidationCount; |
| 289 String m_underInvalidationMessagePrefix; | 288 String m_underInvalidationMessagePrefix; |
| 289 #endif |
| 290 | 290 |
| 291 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 291 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 292 // A stack recording subsequence clients that are currently painting. | 292 // A stack recording subsequence clients that are currently painting. |
| 293 Vector<const DisplayItemClient*> m_currentSubsequenceClients; | 293 Vector<const DisplayItemClient*> m_currentSubsequenceClients; |
| 294 #endif | 294 #endif |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 } // namespace blink | 297 } // namespace blink |
| 298 | 298 |
| 299 #endif // PaintController_h | 299 #endif // PaintController_h |
| OLD | NEW |