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 #if DCHECK_IS_ON() | 168 #ifndef NDEBUG |
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() | |
214 // The following two methods are for checking under-invalidations | 213 // The following two methods are for checking under-invalidations |
215 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl ed). | 214 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl ed). |
pdr.
2016/09/01 16:48:52
Nit: paintUnderInvalidationCheckingEnabled
Xianzhu
2016/09/01 17:00:03
Done.
| |
216 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; |
217 void checkUnderInvalidation(); | 216 void checkUnderInvalidation(); |
218 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin gEnd - m_underInvalidationCheckingBegin > 0; } | 217 bool isCheckingUnderInvalidation() const { return m_underInvalidationCheckin gEnd - m_underInvalidationCheckingBegin > 0; } |
219 #endif | |
220 | 218 |
221 // The last complete paint artifact. | 219 // The last complete paint artifact. |
222 // In SPv2, this includes paint chunks as well as display items. | 220 // In SPv2, this includes paint chunks as well as display items. |
223 PaintArtifact m_currentPaintArtifact; | 221 PaintArtifact m_currentPaintArtifact; |
224 | 222 |
225 // Data being used to build the next paint artifact. | 223 // Data being used to build the next paint artifact. |
226 DisplayItemList m_newDisplayItemList; | 224 DisplayItemList m_newDisplayItemList; |
227 PaintChunker m_newPaintChunks; | 225 PaintChunker m_newPaintChunks; |
228 | 226 |
229 // Allow display item construction to be disabled to isolate the costs of co nstruction | 227 // Allow display item construction to be disabled to isolate the costs of co nstruction |
(...skipping 29 matching lines...) Expand all Loading... | |
259 // Similar to m_outOfOrderItemIndices but | 257 // Similar to m_outOfOrderItemIndices but |
260 // - the indices are chunk indices in m_currentPaintArtifacts.paintChunks(); | 258 // - the indices are chunk indices in m_currentPaintArtifacts.paintChunks(); |
261 // - chunks are matched not only for requests of cached display items, but a lso non-cached display items. | 259 // - chunks are matched not only for requests of cached display items, but a lso non-cached display items. |
262 IndicesByClientMap m_outOfOrderChunkIndices; | 260 IndicesByClientMap m_outOfOrderChunkIndices; |
263 | 261 |
264 bool m_currentChunkIsFromCachedSubsequence; | 262 bool m_currentChunkIsFromCachedSubsequence; |
265 size_t m_nextChunkToMatch; | 263 size_t m_nextChunkToMatch; |
266 | 264 |
267 DisplayItemClient::CacheGenerationOrInvalidationReason m_currentCacheGenerat ion; | 265 DisplayItemClient::CacheGenerationOrInvalidationReason m_currentCacheGenerat ion; |
268 | 266 |
269 #if DCHECK_IS_ON() | 267 #ifndef NDEBUG |
pdr.
2016/09/01 16:48:52
Why did this change to ndebug? (here, and elsewher
Xianzhu
2016/09/01 17:00:03
They are really for debugging, not for checking an
| |
270 int m_numSequentialMatches; | 268 int m_numSequentialMatches; |
271 int m_numOutOfOrderMatches; | 269 int m_numOutOfOrderMatches; |
272 int m_numIndexedItems; | 270 int m_numIndexedItems; |
271 #endif | |
273 | 272 |
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 | |
276 | 277 |
277 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP ossible() | 278 // These are set in useCachedDrawingIfPossible() and useCachedSubsequenceIfP ossible() |
278 // 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, |
279 // 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. |
280 // 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 |
281 // 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. |
282 size_t m_underInvalidationCheckingBegin; | 283 size_t m_underInvalidationCheckingBegin; |
283 size_t m_underInvalidationCheckingEnd; | 284 size_t m_underInvalidationCheckingEnd; |
284 // 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 |
285 // 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 |
286 // compositing folding. | 287 // compositing folding. |
287 int m_skippedProbableUnderInvalidationCount; | 288 int m_skippedProbableUnderInvalidationCount; |
288 String m_underInvalidationMessagePrefix; | 289 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 |