| 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 <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 enum Usage { kForNormalUsage, kForPaintRecordBuilder }; | 188 enum Usage { kForNormalUsage, kForPaintRecordBuilder }; |
| 189 void SetUsage(Usage usage) { usage_ = usage; } | 189 void SetUsage(Usage usage) { usage_ = usage; } |
| 190 bool IsForPaintRecordBuilder() const { | 190 bool IsForPaintRecordBuilder() const { |
| 191 return usage_ == kForPaintRecordBuilder; | 191 return usage_ == kForPaintRecordBuilder; |
| 192 } | 192 } |
| 193 #endif | 193 #endif |
| 194 | 194 |
| 195 void SetTracksRasterInvalidations(bool value); | 195 void SetTracksRasterInvalidations(bool value); |
| 196 RasterInvalidationTrackingMap<const PaintChunk>* | 196 RasterInvalidationTrackingMap<const PaintChunk>* |
| 197 PaintChunksRasterInvalidationTrackingMap() { | 197 PaintChunksRasterInvalidationTrackingMap() { |
| 198 return raster_invalidation_tracking_map_.get(); | 198 return raster_invalidation_tracking_info_ |
| 199 ? &raster_invalidation_tracking_info_->map |
| 200 : nullptr; |
| 199 } | 201 } |
| 200 | 202 |
| 201 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 203 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 202 void BeginShouldKeepAlive(const DisplayItemClient&); | 204 void BeginShouldKeepAlive(const DisplayItemClient&); |
| 203 | 205 |
| 204 void BeginSubsequence(const DisplayItemClient& client) { | 206 void BeginSubsequence(const DisplayItemClient& client) { |
| 205 current_subsequence_clients_.push_back(&client); | 207 current_subsequence_clients_.push_back(&client); |
| 206 BeginShouldKeepAlive(client); | 208 BeginShouldKeepAlive(client); |
| 207 } | 209 } |
| 208 | 210 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 278 |
| 277 // Resets the indices (e.g. m_nextItemToMatch) of | 279 // Resets the indices (e.g. m_nextItemToMatch) of |
| 278 // m_currentPaintArtifact.getDisplayItemList() to their initial values. This | 280 // m_currentPaintArtifact.getDisplayItemList() to their initial values. This |
| 279 // should be called when the DisplayItemList in m_currentPaintArtifact is | 281 // should be called when the DisplayItemList in m_currentPaintArtifact is |
| 280 // newly created, or is changed causing the previous indices to be invalid. | 282 // newly created, or is changed causing the previous indices to be invalid. |
| 281 void ResetCurrentListIndices(); | 283 void ResetCurrentListIndices(); |
| 282 | 284 |
| 283 void GenerateRasterInvalidations(PaintChunk& new_chunk); | 285 void GenerateRasterInvalidations(PaintChunk& new_chunk); |
| 284 void GenerateRasterInvalidationsComparingChunks(PaintChunk& new_chunk, | 286 void GenerateRasterInvalidationsComparingChunks(PaintChunk& new_chunk, |
| 285 const PaintChunk& old_chunk); | 287 const PaintChunk& old_chunk); |
| 286 inline void AddRasterInvalidation(const DisplayItemClient*, | 288 inline void AddRasterInvalidation(const DisplayItemClient&, |
| 287 PaintChunk&, | 289 PaintChunk&, |
| 288 const FloatRect&); | 290 const FloatRect&); |
| 289 void TrackRasterInvalidation(const DisplayItemClient*, | 291 void TrackRasterInvalidation(const DisplayItemClient&, |
| 290 PaintChunk&, | 292 PaintChunk&, |
| 291 const FloatRect&); | 293 const FloatRect&); |
| 292 | 294 |
| 293 // The following two methods are for checking under-invalidations | 295 // The following two methods are for checking under-invalidations |
| 294 // (when RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled). | 296 // (when RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled). |
| 295 void ShowUnderInvalidationError(const char* reason, | 297 void ShowUnderInvalidationError(const char* reason, |
| 296 const DisplayItem& new_item, | 298 const DisplayItem& new_item, |
| 297 const DisplayItem* old_item) const; | 299 const DisplayItem* old_item) const; |
| 298 | 300 |
| 299 void ShowSequenceUnderInvalidationError(const char* reason, | 301 void ShowSequenceUnderInvalidationError(const char* reason, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // check if the actual painting results are the same as the cached. | 407 // check if the actual painting results are the same as the cached. |
| 406 size_t under_invalidation_checking_begin_; | 408 size_t under_invalidation_checking_begin_; |
| 407 size_t under_invalidation_checking_end_; | 409 size_t under_invalidation_checking_end_; |
| 408 | 410 |
| 409 // Number of probable under-invalidations that have been skipped temporarily | 411 // Number of probable under-invalidations that have been skipped temporarily |
| 410 // because the mismatching display items may be removed in the future because | 412 // because the mismatching display items may be removed in the future because |
| 411 // of no-op pairs or compositing folding. | 413 // of no-op pairs or compositing folding. |
| 412 int skipped_probable_under_invalidation_count_; | 414 int skipped_probable_under_invalidation_count_; |
| 413 String under_invalidation_message_prefix_; | 415 String under_invalidation_message_prefix_; |
| 414 | 416 |
| 415 std::unique_ptr<RasterInvalidationTrackingMap<const PaintChunk>> | 417 struct RasterInvalidationTrackingInfo { |
| 416 raster_invalidation_tracking_map_; | 418 RasterInvalidationTrackingMap<const PaintChunk> map; |
| 419 using ClientDebugNamesMap = HashMap<const DisplayItemClient*, String>; |
| 420 ClientDebugNamesMap new_client_debug_names; |
| 421 ClientDebugNamesMap old_client_debug_names; |
| 422 }; |
| 423 std::unique_ptr<RasterInvalidationTrackingInfo> |
| 424 raster_invalidation_tracking_info_; |
| 417 | 425 |
| 418 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 426 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 419 // A stack recording subsequence clients that are currently painting. | 427 // A stack recording subsequence clients that are currently painting. |
| 420 Vector<const DisplayItemClient*> current_subsequence_clients_; | 428 Vector<const DisplayItemClient*> current_subsequence_clients_; |
| 421 #endif | 429 #endif |
| 422 | 430 |
| 423 typedef HashMap<const DisplayItemClient*, SubsequenceMarkers> | 431 typedef HashMap<const DisplayItemClient*, SubsequenceMarkers> |
| 424 CachedSubsequenceMap; | 432 CachedSubsequenceMap; |
| 425 CachedSubsequenceMap current_cached_subsequences_; | 433 CachedSubsequenceMap current_cached_subsequences_; |
| 426 CachedSubsequenceMap new_cached_subsequences_; | 434 CachedSubsequenceMap new_cached_subsequences_; |
| 427 size_t last_cached_subsequence_end_; | 435 size_t last_cached_subsequence_end_; |
| 428 | 436 |
| 429 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); | 437 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedSubsequenceSwapOrder); |
| 430 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); | 438 FRIEND_TEST_ALL_PREFIXES(PaintControllerTest, CachedNestedSubsequenceUpdate); |
| 431 }; | 439 }; |
| 432 | 440 |
| 433 } // namespace blink | 441 } // namespace blink |
| 434 | 442 |
| 435 #endif // PaintController_h | 443 #endif // PaintController_h |
| OLD | NEW |