| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 #if DCHECK_IS_ON() | 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 PaintControllerTest; | 178 friend class PaintControllerTestBase; |
| 179 friend class PaintControllerPaintTestBase; | 179 friend class PaintControllerPaintTestBase; |
| 180 | 180 |
| 181 void ensureNewDisplayItemListInitialCapacity() | 181 void ensureNewDisplayItemListInitialCapacity() |
| 182 { | 182 { |
| 183 if (m_newDisplayItemList.isEmpty()) { | 183 if (m_newDisplayItemList.isEmpty()) { |
| 184 // TODO(wangxianzhu): Consider revisiting this heuristic. | 184 // TODO(wangxianzhu): Consider revisiting this heuristic. |
| 185 m_newDisplayItemList = DisplayItemList(m_currentPaintArtifact.getDis
playItemList().isEmpty() ? kInitialDisplayItemListCapacityBytes : m_currentPaint
Artifact.getDisplayItemList().usedCapacityInBytes()); | 185 m_newDisplayItemList = DisplayItemList(m_currentPaintArtifact.getDis
playItemList().isEmpty() ? kInitialDisplayItemListCapacityBytes : m_currentPaint
Artifact.getDisplayItemList().usedCapacityInBytes()); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 205 void copyCachedSubsequence(size_t&); | 205 void copyCachedSubsequence(size_t&); |
| 206 | 206 |
| 207 // Resets the indices (e.g. m_nextItemToMatch) of m_currentPaintArtifact.get
DisplayItemList() | 207 // Resets the indices (e.g. m_nextItemToMatch) of m_currentPaintArtifact.get
DisplayItemList() |
| 208 // to their initial values. This should be called when the DisplayItemList i
n m_currentPaintArtifact | 208 // to their initial values. This should be called when the DisplayItemList i
n m_currentPaintArtifact |
| 209 // is newly created, or is changed causing the previous indices to be invali
d. | 209 // is newly created, or is changed causing the previous indices to be invali
d. |
| 210 void resetCurrentListIndices(); | 210 void resetCurrentListIndices(); |
| 211 | 211 |
| 212 #if DCHECK_IS_ON() | 212 #if DCHECK_IS_ON() |
| 213 // The following two methods are for checking under-invalidations | 213 // The following two methods are for checking under-invalidations |
| 214 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl
ed). | 214 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl
ed). |
| 215 void showUnderInvalidationError(const char* reason, const DisplayItem& newIt
em, const DisplayItem& oldItem) const; | 215 void showUnderInvalidationError(const char* reason, const DisplayItem& newIt
em, const DisplayItem* oldItem) const; |
| 216 void checkUnderInvalidation(); | 216 void checkUnderInvalidation(); |
| 217 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin
gEnd - m_underInvalidationCheckingBegin > 0; } | 217 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin
gEnd - m_underInvalidationCheckingBegin > 0; } |
| 218 #endif | 218 #endif |
| 219 | 219 |
| 220 // The last complete paint artifact. | 220 // The last complete paint artifact. |
| 221 // In SPv2, this includes paint chunks as well as display items. | 221 // In SPv2, this includes paint chunks as well as display items. |
| 222 PaintArtifact m_currentPaintArtifact; | 222 PaintArtifact m_currentPaintArtifact; |
| 223 | 223 |
| 224 // Data being used to build the next paint artifact. | 224 // Data being used to build the next paint artifact. |
| 225 DisplayItemList m_newDisplayItemList; | 225 DisplayItemList m_newDisplayItemList; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // This is used to check duplicated ids during createAndAppend(). | 264 // This is used to check duplicated ids during createAndAppend(). |
| 265 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 265 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 266 | 266 |
| 267 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP
ossible() | 267 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP
ossible() |
| 268 // when we could use cached drawing or subsequence and under-invalidation ch
ecking is on, | 268 // when we could use cached drawing or subsequence and under-invalidation ch
ecking is on, |
| 269 // indicating the begin and end of the cached drawing or subsequence in the
current list. | 269 // indicating the begin and end of the cached drawing or subsequence in the
current list. |
| 270 // The functions return false to let the client do actual painting, and Pain
tController | 270 // The functions return false to let the client do actual painting, and Pain
tController |
| 271 // will check if the actual painting results are the same as the cached. | 271 // will check if the actual painting results are the same as the cached. |
| 272 size_t m_underInvalidationCheckingBegin; | 272 size_t m_underInvalidationCheckingBegin; |
| 273 size_t m_underInvalidationCheckingEnd; | 273 size_t m_underInvalidationCheckingEnd; |
| 274 // Number of probable under-invalidations that have been skipped temporarily
because the |
| 275 // mismatching display items may be removed in the future because of no-op p
airs or |
| 276 // compositing folding. |
| 277 int m_skippedProbableUnderInvalidationCount; |
| 274 String m_underInvalidationMessagePrefix; | 278 String m_underInvalidationMessagePrefix; |
| 275 #endif | 279 #endif |
| 276 | 280 |
| 277 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 281 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 278 // A stack recording subsequence clients that are currently painting. | 282 // A stack recording subsequence clients that are currently painting. |
| 279 Vector<const DisplayItemClient*> m_currentSubsequenceClients; | 283 Vector<const DisplayItemClient*> m_currentSubsequenceClients; |
| 280 #endif | 284 #endif |
| 281 }; | 285 }; |
| 282 | 286 |
| 283 } // namespace blink | 287 } // namespace blink |
| 284 | 288 |
| 285 #endif // PaintController_h | 289 #endif // PaintController_h |
| OLD | NEW |