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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // Memory outside this class due to m_newDisplayItemList. | 669 // Memory outside this class due to m_newDisplayItemList. |
670 DCHECK(new_display_item_list_.IsEmpty()); | 670 DCHECK(new_display_item_list_.IsEmpty()); |
671 memory_usage += new_display_item_list_.MemoryUsageInBytes(); | 671 memory_usage += new_display_item_list_.MemoryUsageInBytes(); |
672 | 672 |
673 return memory_usage; | 673 return memory_usage; |
674 } | 674 } |
675 | 675 |
676 void PaintController::AppendDebugDrawingAfterCommit( | 676 void PaintController::AppendDebugDrawingAfterCommit( |
677 const DisplayItemClient& display_item_client, | 677 const DisplayItemClient& display_item_client, |
678 sk_sp<PaintRecord> record, | 678 sk_sp<PaintRecord> record, |
679 const FloatRect& record_bounds, | |
680 const LayoutSize& offset_from_layout_object) { | 679 const LayoutSize& offset_from_layout_object) { |
681 DCHECK(new_display_item_list_.IsEmpty()); | 680 DCHECK(new_display_item_list_.IsEmpty()); |
682 DrawingDisplayItem& display_item = | 681 DrawingDisplayItem& display_item = |
683 current_paint_artifact_.GetDisplayItemList() | 682 current_paint_artifact_.GetDisplayItemList() |
684 .AllocateAndConstruct<DrawingDisplayItem>( | 683 .AllocateAndConstruct<DrawingDisplayItem>(display_item_client, |
685 display_item_client, DisplayItem::kDebugDrawing, | 684 DisplayItem::kDebugDrawing, |
686 std::move(record), record_bounds); | 685 std::move(record)); |
687 display_item.SetSkippedCache(); | 686 display_item.SetSkippedCache(); |
688 // TODO(wkorman): Only compute and append visual rect for drawings. | 687 // TODO(wkorman): Only compute and append visual rect for drawings. |
689 current_paint_artifact_.GetDisplayItemList().AppendVisualRect( | 688 current_paint_artifact_.GetDisplayItemList().AppendVisualRect( |
690 VisualRectForDisplayItem(display_item, offset_from_layout_object)); | 689 VisualRectForDisplayItem(display_item, offset_from_layout_object)); |
691 } | 690 } |
692 | 691 |
693 void PaintController::GenerateRasterInvalidations(PaintChunk& new_chunk) { | 692 void PaintController::GenerateRasterInvalidations(PaintChunk& new_chunk) { |
694 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 693 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
695 if (new_chunk.begin_index >= | 694 if (new_chunk.begin_index >= |
696 current_cached_subsequence_begin_index_in_new_list_) | 695 current_cached_subsequence_begin_index_in_new_list_) |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 LOG(ERROR) << "New display item: " << new_item.AsDebugString(); | 852 LOG(ERROR) << "New display item: " << new_item.AsDebugString(); |
854 LOG(ERROR) << "Old display item: " | 853 LOG(ERROR) << "Old display item: " |
855 << (old_item ? old_item->AsDebugString() : "None"); | 854 << (old_item ? old_item->AsDebugString() : "None"); |
856 #else | 855 #else |
857 LOG(ERROR) << "Run debug build to get more details."; | 856 LOG(ERROR) << "Run debug build to get more details."; |
858 #endif | 857 #endif |
859 LOG(ERROR) << "See http://crbug.com/619103."; | 858 LOG(ERROR) << "See http://crbug.com/619103."; |
860 | 859 |
861 #ifndef NDEBUG | 860 #ifndef NDEBUG |
862 const PaintRecord* new_record = nullptr; | 861 const PaintRecord* new_record = nullptr; |
863 SkRect new_bounds; | |
864 if (new_item.IsDrawing()) { | 862 if (new_item.IsDrawing()) { |
865 new_record = | 863 new_record = |
866 static_cast<const DrawingDisplayItem&>(new_item).GetPaintRecord().get(); | 864 static_cast<const DrawingDisplayItem&>(new_item).GetPaintRecord().get(); |
867 new_bounds = | |
868 static_cast<const DrawingDisplayItem&>(new_item).GetPaintRecordBounds(); | |
869 } | 865 } |
870 const PaintRecord* old_record = nullptr; | 866 const PaintRecord* old_record = nullptr; |
871 SkRect old_bounds; | |
872 if (old_item->IsDrawing()) { | 867 if (old_item->IsDrawing()) { |
873 old_record = static_cast<const DrawingDisplayItem*>(old_item) | 868 old_record = static_cast<const DrawingDisplayItem*>(old_item) |
874 ->GetPaintRecord() | 869 ->GetPaintRecord() |
875 .get(); | 870 .get(); |
876 old_bounds = | |
877 static_cast<const DrawingDisplayItem&>(new_item).GetPaintRecordBounds(); | |
878 } | 871 } |
879 LOG(INFO) << "new record:\n" | 872 LOG(INFO) << "new record:\n" |
880 << (new_record ? RecordAsDebugString(new_record, new_bounds) | 873 << (new_record ? RecordAsDebugString(new_record) : "None"); |
881 : "None"); | |
882 LOG(INFO) << "old record:\n" | 874 LOG(INFO) << "old record:\n" |
883 << (old_record ? RecordAsDebugString(old_record, old_bounds) | 875 << (old_record ? RecordAsDebugString(old_record) : "None"); |
884 : "None"); | |
885 | 876 |
886 ShowDebugData(); | 877 ShowDebugData(); |
887 #endif // NDEBUG | 878 #endif // NDEBUG |
888 } | 879 } |
889 | 880 |
890 void PaintController::ShowSequenceUnderInvalidationError( | 881 void PaintController::ShowSequenceUnderInvalidationError( |
891 const char* reason, | 882 const char* reason, |
892 const DisplayItemClient& client, | 883 const DisplayItemClient& client, |
893 int start, | 884 int start, |
894 int end) { | 885 int end) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 } | 996 } |
1006 | 997 |
1007 FrameFirstPaint PaintController::EndFrame(const void* frame) { | 998 FrameFirstPaint PaintController::EndFrame(const void* frame) { |
1008 FrameFirstPaint result = frame_first_paints_.back(); | 999 FrameFirstPaint result = frame_first_paints_.back(); |
1009 DCHECK(result.frame == frame); | 1000 DCHECK(result.frame == frame); |
1010 frame_first_paints_.pop_back(); | 1001 frame_first_paints_.pop_back(); |
1011 return result; | 1002 return result; |
1012 } | 1003 } |
1013 | 1004 |
1014 } // namespace blink | 1005 } // namespace blink |
OLD | NEW |