Chromium Code Reviews| 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 #include "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
| 6 | 6 |
| 7 #include "platform/graphics/GraphicsLayer.h" | 7 #include "platform/graphics/GraphicsLayer.h" |
| 8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 9 #include "platform/instrumentation/tracing/TraceEvent.h" | 9 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 10 #include "platform/wtf/AutoReset.h" | 10 #include "platform/wtf/AutoReset.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 AutoReset<size_t> subsequence_begin_index( | 447 AutoReset<size_t> subsequence_begin_index( |
| 448 ¤t_cached_subsequence_begin_index_in_new_list_, | 448 ¤t_cached_subsequence_begin_index_in_new_list_, |
| 449 new_display_item_list_.size()); | 449 new_display_item_list_.size()); |
| 450 DisplayItem* cached_item = | 450 DisplayItem* cached_item = |
| 451 ¤t_paint_artifact_.GetDisplayItemList()[begin_index]; | 451 ¤t_paint_artifact_.GetDisplayItemList()[begin_index]; |
| 452 | 452 |
| 453 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 453 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 454 DCHECK(!IsCheckingUnderInvalidation()); | 454 DCHECK(!IsCheckingUnderInvalidation()); |
| 455 under_invalidation_checking_begin_ = begin_index; | 455 under_invalidation_checking_begin_ = begin_index; |
| 456 under_invalidation_message_prefix_ = | 456 under_invalidation_message_prefix_ = |
| 457 "(In cached subsequence of " + cached_item->Client().DebugName() + ")"; | 457 "(In cached subsequence starting with " + |
| 458 cached_item->Client().DebugName() + ")"; | |
| 458 } | 459 } |
| 459 | 460 |
| 460 Vector<PaintChunk>::const_iterator cached_chunk; | 461 Vector<PaintChunk>::const_iterator cached_chunk; |
| 461 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 462 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 462 cached_chunk = | 463 cached_chunk = |
| 463 current_paint_artifact_.FindChunkByDisplayItemIndex(begin_index); | 464 current_paint_artifact_.FindChunkByDisplayItemIndex(begin_index); |
| 464 DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); | 465 DCHECK(cached_chunk != current_paint_artifact_.PaintChunks().end()); |
| 465 UpdateCurrentPaintChunkProperties( | 466 UpdateCurrentPaintChunkProperties( |
| 466 cached_chunk->id ? &*cached_chunk->id : nullptr, | 467 cached_chunk->id ? &*cached_chunk->id : nullptr, |
| 467 cached_chunk->properties); | 468 cached_chunk->properties); |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 : nullptr; | 870 : nullptr; |
| 870 | 871 |
| 871 bool old_and_new_equal = old_item && new_item.Equals(*old_item); | 872 bool old_and_new_equal = old_item && new_item.Equals(*old_item); |
| 872 if (!old_and_new_equal) { | 873 if (!old_and_new_equal) { |
| 873 if (new_item.IsBegin()) { | 874 if (new_item.IsBegin()) { |
| 874 // Temporarily skip mismatching begin display item which may be removed | 875 // Temporarily skip mismatching begin display item which may be removed |
| 875 // when we remove a no-op pair. | 876 // when we remove a no-op pair. |
| 876 ++skipped_probable_under_invalidation_count_; | 877 ++skipped_probable_under_invalidation_count_; |
| 877 return; | 878 return; |
| 878 } | 879 } |
| 879 if (new_item.IsDrawing() && | |
| 880 skipped_probable_under_invalidation_count_ == 1) { | |
| 881 DCHECK_GE(new_display_item_list_.size(), 2u); | |
| 882 if (new_display_item_list_[new_display_item_list_.size() - 2].GetType() == | |
| 883 DisplayItem::kBeginCompositing) { | |
| 884 // This might be a drawing item between a pair of begin/end compositing | |
| 885 // display items that will be folded into a single drawing display item. | |
| 886 ++skipped_probable_under_invalidation_count_; | |
|
Xianzhu
2017/04/18 00:15:21
Doesn't the logic apply now?
chrishtr
2017/04/18 21:13:13
It doesn't, because the folding optimization in Co
| |
| 887 return; | |
| 888 } | |
| 889 } | |
| 890 } | 880 } |
| 891 | 881 |
| 892 if (skipped_probable_under_invalidation_count_ || !old_and_new_equal) { | 882 if (skipped_probable_under_invalidation_count_ || !old_and_new_equal) { |
| 893 // If we ever skipped reporting any under-invalidations, report the earliest | 883 // If we ever skipped reporting any under-invalidations, report the earliest |
| 894 // one. | 884 // one. |
| 895 ShowUnderInvalidationError( | 885 ShowUnderInvalidationError( |
| 896 "under-invalidation: display item changed", | 886 "under-invalidation: display item changed", |
| 897 new_display_item_list_[new_display_item_list_.size() - | 887 new_display_item_list_[new_display_item_list_.size() - |
| 898 skipped_probable_under_invalidation_count_ - 1], | 888 skipped_probable_under_invalidation_count_ - 1], |
| 899 ¤t_paint_artifact_ | 889 ¤t_paint_artifact_ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 show_paint_records | 924 show_paint_records |
| 935 ? (DisplayItemList::JsonOptions::kShowPaintRecords | | 925 ? (DisplayItemList::JsonOptions::kShowPaintRecords | |
| 936 DisplayItemList::JsonOptions::kShowClientDebugName) | 926 DisplayItemList::JsonOptions::kShowClientDebugName) |
| 937 : DisplayItemList::JsonOptions::kShowClientDebugName) | 927 : DisplayItemList::JsonOptions::kShowClientDebugName) |
| 938 ->ToPrettyJSONString() | 928 ->ToPrettyJSONString() |
| 939 .Utf8() | 929 .Utf8() |
| 940 .Data()); | 930 .Data()); |
| 941 } | 931 } |
| 942 | 932 |
| 943 } // namespace blink | 933 } // namespace blink |
| OLD | NEW |