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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 sk_sp<SkPicture>, | 180 sk_sp<SkPicture>, |
181 const LayoutSize& offsetFromLayoutObject); | 181 const LayoutSize& offsetFromLayoutObject); |
182 | 182 |
183 void showDebugData() const { showDebugDataInternal(false); } | 183 void showDebugData() const { showDebugDataInternal(false); } |
184 #ifndef NDEBUG | 184 #ifndef NDEBUG |
185 void showDebugDataWithPictures() const { showDebugDataInternal(true); } | 185 void showDebugDataWithPictures() const { showDebugDataInternal(true); } |
186 #endif | 186 #endif |
187 | 187 |
188 #if DCHECK_IS_ON() | 188 #if DCHECK_IS_ON() |
189 void assertDisplayItemClientsAreLive(); | 189 void assertDisplayItemClientsAreLive(); |
| 190 |
| 191 enum Usage { ForNormalUsage, ForSkPictureBuilder }; |
| 192 void setUsage(Usage usage) { m_usage = usage; } |
| 193 bool isForSkPictureBuilder() const { return m_usage == ForSkPictureBuilder; } |
190 #endif | 194 #endif |
191 | 195 |
192 void setTracksRasterInvalidations(bool value); | 196 void setTracksRasterInvalidations(bool value); |
193 RasterInvalidationTrackingMap<const PaintChunk>* | 197 RasterInvalidationTrackingMap<const PaintChunk>* |
194 paintChunksRasterInvalidationTrackingMap() { | 198 paintChunksRasterInvalidationTrackingMap() { |
195 return m_paintChunksRasterInvalidationTrackingMap.get(); | 199 return m_paintChunksRasterInvalidationTrackingMap.get(); |
196 } | 200 } |
197 | 201 |
198 protected: | 202 protected: |
199 PaintController() | 203 PaintController() |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 348 |
345 #ifndef NDEBUG | 349 #ifndef NDEBUG |
346 int m_numSequentialMatches; | 350 int m_numSequentialMatches; |
347 int m_numOutOfOrderMatches; | 351 int m_numOutOfOrderMatches; |
348 int m_numIndexedItems; | 352 int m_numIndexedItems; |
349 #endif | 353 #endif |
350 | 354 |
351 #if DCHECK_IS_ON() | 355 #if DCHECK_IS_ON() |
352 // This is used to check duplicated ids during createAndAppend(). | 356 // This is used to check duplicated ids during createAndAppend(). |
353 IndicesByClientMap m_newDisplayItemIndicesByClient; | 357 IndicesByClientMap m_newDisplayItemIndicesByClient; |
| 358 |
| 359 Usage m_usage; |
354 #endif | 360 #endif |
355 | 361 |
356 // These are set in useCachedDrawingIfPossible() and | 362 // These are set in useCachedDrawingIfPossible() and |
357 // useCachedSubsequenceIfPossible() when we could use cached drawing or | 363 // useCachedSubsequenceIfPossible() when we could use cached drawing or |
358 // subsequence and under-invalidation checking is on, indicating the begin and | 364 // subsequence and under-invalidation checking is on, indicating the begin and |
359 // end of the cached drawing or subsequence in the current list. The functions | 365 // end of the cached drawing or subsequence in the current list. The functions |
360 // return false to let the client do actual painting, and PaintController will | 366 // return false to let the client do actual painting, and PaintController will |
361 // check if the actual painting results are the same as the cached. | 367 // check if the actual painting results are the same as the cached. |
362 size_t m_underInvalidationCheckingBegin; | 368 size_t m_underInvalidationCheckingBegin; |
363 size_t m_underInvalidationCheckingEnd; | 369 size_t m_underInvalidationCheckingEnd; |
364 | 370 |
365 // Number of probable under-invalidations that have been skipped temporarily | 371 // Number of probable under-invalidations that have been skipped temporarily |
366 // because the mismatching display items may be removed in the future because | 372 // because the mismatching display items may be removed in the future because |
367 // of no-op pairs or compositing folding. | 373 // of no-op pairs or compositing folding. |
368 int m_skippedProbableUnderInvalidationCount; | 374 int m_skippedProbableUnderInvalidationCount; |
369 String m_underInvalidationMessagePrefix; | 375 String m_underInvalidationMessagePrefix; |
370 | 376 |
371 std::unique_ptr<RasterInvalidationTrackingMap<const PaintChunk>> | 377 std::unique_ptr<RasterInvalidationTrackingMap<const PaintChunk>> |
372 m_paintChunksRasterInvalidationTrackingMap; | 378 m_paintChunksRasterInvalidationTrackingMap; |
373 | 379 |
374 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 380 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
375 // A stack recording subsequence clients that are currently painting. | 381 // A stack recording subsequence clients that are currently painting. |
376 Vector<const DisplayItemClient*> m_currentSubsequenceClients; | 382 Vector<const DisplayItemClient*> m_currentSubsequenceClients; |
377 #endif | 383 #endif |
378 }; | 384 }; |
379 | 385 |
380 } // namespace blink | 386 } // namespace blink |
381 | 387 |
382 #endif // PaintController_h | 388 #endif // PaintController_h |
OLD | NEW |