Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "third_party/skia/include/core/SkPictureAnalyzer.h" 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 size_t PaintController::approximateUnsharedMemoryUsage() const { 580 size_t PaintController::approximateUnsharedMemoryUsage() const {
581 size_t memoryUsage = sizeof(*this); 581 size_t memoryUsage = sizeof(*this);
582 582
583 // Memory outside this class due to m_currentPaintArtifact. 583 // Memory outside this class due to m_currentPaintArtifact.
584 memoryUsage += m_currentPaintArtifact.approximateUnsharedMemoryUsage() - 584 memoryUsage += m_currentPaintArtifact.approximateUnsharedMemoryUsage() -
585 sizeof(m_currentPaintArtifact); 585 sizeof(m_currentPaintArtifact);
586 586
587 // TODO(jbroman): If display items begin to have significant external memory 587 // TODO(jbroman): If display items begin to have significant external memory
588 // usage that's not shared with the embedder, we should account for it here. 588 // usage that's not shared with the embedder, we should account for it here.
589 // 589 //
590 // External objects, shared with the embedder, such as SkPicture, should be 590 // External objects, shared with the embedder, such as PaintRecord, should be
591 // excluded to avoid double counting. It is the embedder's responsibility to 591 // excluded to avoid double counting. It is the embedder's responsibility to
592 // count such objects. 592 // count such objects.
593 // 593 //
594 // At time of writing, the only known case of unshared external memory was 594 // At time of writing, the only known case of unshared external memory was
595 // the rounded clips vector in ClipDisplayItem, which is not expected to 595 // the rounded clips vector in ClipDisplayItem, which is not expected to
596 // contribute significantly to memory usage. 596 // contribute significantly to memory usage.
597 597
598 // Memory outside this class due to m_newDisplayItemList. 598 // Memory outside this class due to m_newDisplayItemList.
599 DCHECK(m_newDisplayItemList.isEmpty()); 599 DCHECK(m_newDisplayItemList.isEmpty());
600 memoryUsage += m_newDisplayItemList.memoryUsageInBytes(); 600 memoryUsage += m_newDisplayItemList.memoryUsageInBytes();
601 601
602 return memoryUsage; 602 return memoryUsage;
603 } 603 }
604 604
605 void PaintController::appendDebugDrawingAfterCommit( 605 void PaintController::appendDebugDrawingAfterCommit(
606 const DisplayItemClient& displayItemClient, 606 const DisplayItemClient& displayItemClient,
607 sk_sp<SkPicture> picture, 607 sk_sp<PaintRecord> picture,
608 const LayoutSize& offsetFromLayoutObject) { 608 const LayoutSize& offsetFromLayoutObject) {
609 DCHECK(m_newDisplayItemList.isEmpty()); 609 DCHECK(m_newDisplayItemList.isEmpty());
610 DrawingDisplayItem& displayItem = 610 DrawingDisplayItem& displayItem =
611 m_currentPaintArtifact.getDisplayItemList() 611 m_currentPaintArtifact.getDisplayItemList()
612 .allocateAndConstruct<DrawingDisplayItem>(displayItemClient, 612 .allocateAndConstruct<DrawingDisplayItem>(displayItemClient,
613 DisplayItem::kDebugDrawing, 613 DisplayItem::kDebugDrawing,
614 std::move(picture)); 614 std::move(picture));
615 displayItem.setSkippedCache(); 615 displayItem.setSkippedCache();
616 // TODO(wkorman): Only compute and append visual rect for drawings. 616 // TODO(wkorman): Only compute and append visual rect for drawings.
617 m_currentPaintArtifact.getDisplayItemList().appendVisualRect( 617 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 #ifndef NDEBUG 760 #ifndef NDEBUG
761 LOG(ERROR) << "New display item: " << newItem.asDebugString(); 761 LOG(ERROR) << "New display item: " << newItem.asDebugString();
762 LOG(ERROR) << "Old display item: " 762 LOG(ERROR) << "Old display item: "
763 << (oldItem ? oldItem->asDebugString() : "None"); 763 << (oldItem ? oldItem->asDebugString() : "None");
764 #else 764 #else
765 LOG(ERROR) << "Run debug build to get more details."; 765 LOG(ERROR) << "Run debug build to get more details.";
766 #endif 766 #endif
767 LOG(ERROR) << "See http://crbug.com/619103."; 767 LOG(ERROR) << "See http://crbug.com/619103.";
768 768
769 #ifndef NDEBUG 769 #ifndef NDEBUG
770 const SkPicture* newPicture = 770 const PaintRecord* newPicture =
771 newItem.isDrawing() 771 newItem.isDrawing()
772 ? static_cast<const DrawingDisplayItem&>(newItem).picture() 772 ? static_cast<const DrawingDisplayItem&>(newItem).picture()
773 : nullptr; 773 : nullptr;
774 const SkPicture* oldPicture = 774 const PaintRecord* oldPicture =
775 oldItem && oldItem->isDrawing() 775 oldItem && oldItem->isDrawing()
776 ? static_cast<const DrawingDisplayItem*>(oldItem)->picture() 776 ? static_cast<const DrawingDisplayItem*>(oldItem)->picture()
777 : nullptr; 777 : nullptr;
778 LOG(INFO) << "new picture:\n" 778 LOG(INFO) << "new picture:\n"
779 << (newPicture ? pictureAsDebugString(newPicture) : "None"); 779 << (newPicture ? pictureAsDebugString(newPicture) : "None");
780 LOG(INFO) << "old picture:\n" 780 LOG(INFO) << "old picture:\n"
781 << (oldPicture ? pictureAsDebugString(oldPicture) : "None"); 781 << (oldPicture ? pictureAsDebugString(oldPicture) : "None");
782 782
783 showDebugData(); 783 showDebugData();
784 #endif // NDEBUG 784 #endif // NDEBUG
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 0, m_newDisplayItemList.size(), 861 0, m_newDisplayItemList.size(),
862 showPictures ? (DisplayItemList::JsonOptions::ShowPictures | 862 showPictures ? (DisplayItemList::JsonOptions::ShowPictures |
863 DisplayItemList::JsonOptions::ShowClientDebugName) 863 DisplayItemList::JsonOptions::ShowClientDebugName)
864 : DisplayItemList::JsonOptions::ShowClientDebugName) 864 : DisplayItemList::JsonOptions::ShowClientDebugName)
865 ->toPrettyJSONString() 865 ->toPrettyJSONString()
866 .utf8() 866 .utf8()
867 .data()); 867 .data());
868 } 868 }
869 869
870 } // namespace blink 870 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698