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