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 #if DCHECK_IS_ON() | 169 #ifndef NDEBUG |
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() | |
215 // The following two methods are for checking under-invalidations | 214 // The following two methods are for checking under-invalidations |
216 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl
ed). | 215 // (when RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled). |
217 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; |
218 void checkUnderInvalidation(); | 217 void checkUnderInvalidation(); |
219 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin
gEnd - m_underInvalidationCheckingBegin > 0; } | 218 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin
gEnd - m_underInvalidationCheckingBegin > 0; } |
220 #endif | |
221 | 219 |
222 // The last complete paint artifact. | 220 // The last complete paint artifact. |
223 // In SPv2, this includes paint chunks as well as display items. | 221 // In SPv2, this includes paint chunks as well as display items. |
224 PaintArtifact m_currentPaintArtifact; | 222 PaintArtifact m_currentPaintArtifact; |
225 | 223 |
226 // Data being used to build the next paint artifact. | 224 // Data being used to build the next paint artifact. |
227 DisplayItemList m_newDisplayItemList; | 225 DisplayItemList m_newDisplayItemList; |
228 PaintChunker m_newPaintChunks; | 226 PaintChunker m_newPaintChunks; |
229 | 227 |
230 // Allow display item construction to be disabled to isolate the costs of co
nstruction | 228 // Allow display item construction to be disabled to isolate the costs of co
nstruction |
(...skipping 29 matching lines...) Expand all Loading... |
260 // Similar to m_outOfOrderItemIndices but | 258 // Similar to m_outOfOrderItemIndices but |
261 // - the indices are chunk indices in m_currentPaintArtifacts.paintChunks(); | 259 // - the indices are chunk indices in m_currentPaintArtifacts.paintChunks(); |
262 // - chunks are matched not only for requests of cached display items, but a
lso non-cached display items. | 260 // - chunks are matched not only for requests of cached display items, but a
lso non-cached display items. |
263 IndicesByClientMap m_outOfOrderChunkIndices; | 261 IndicesByClientMap m_outOfOrderChunkIndices; |
264 | 262 |
265 bool m_currentChunkIsFromCachedSubsequence; | 263 bool m_currentChunkIsFromCachedSubsequence; |
266 size_t m_nextChunkToMatch; | 264 size_t m_nextChunkToMatch; |
267 | 265 |
268 DisplayItemClient::CacheGenerationOrInvalidationReason m_currentCacheGenerat
ion; | 266 DisplayItemClient::CacheGenerationOrInvalidationReason m_currentCacheGenerat
ion; |
269 | 267 |
270 #if DCHECK_IS_ON() | 268 #ifndef NDEBUG |
271 int m_numSequentialMatches; | 269 int m_numSequentialMatches; |
272 int m_numOutOfOrderMatches; | 270 int m_numOutOfOrderMatches; |
273 int m_numIndexedItems; | 271 int m_numIndexedItems; |
| 272 #endif |
274 | 273 |
| 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 |
277 | 278 |
278 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP
ossible() | 279 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP
ossible() |
279 // when we could use cached drawing or subsequence and under-invalidation ch
ecking is on, | 280 // 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. | 281 // 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 | 282 // 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. | 283 // will check if the actual painting results are the same as the cached. |
283 size_t m_underInvalidationCheckingBegin; | 284 size_t m_underInvalidationCheckingBegin; |
284 size_t m_underInvalidationCheckingEnd; | 285 size_t m_underInvalidationCheckingEnd; |
285 // Number of probable under-invalidations that have been skipped temporarily
because the | 286 // 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 | 287 // mismatching display items may be removed in the future because of no-op p
airs or |
287 // compositing folding. | 288 // compositing folding. |
288 int m_skippedProbableUnderInvalidationCount; | 289 int m_skippedProbableUnderInvalidationCount; |
289 String m_underInvalidationMessagePrefix; | 290 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 |