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