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

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

Issue 2324523003: Add PaintController::showDebugDataWithPictures() (Closed)
Patch Set: ndef NDEBUG Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/TraceEvent.h" 7 #include "platform/TraceEvent.h"
8 #include "platform/graphics/GraphicsLayer.h" 8 #include "platform/graphics/GraphicsLayer.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 // Discard the forced repainted display item and move the cached item into m _newDisplayItemList. 665 // Discard the forced repainted display item and move the cached item into m _newDisplayItemList.
666 // This is to align with the non-under-invalidation-checking path to empty t he original cached slot, 666 // This is to align with the non-under-invalidation-checking path to empty t he original cached slot,
667 // leaving only disappeared or invalidated display items in the old list aft er painting. 667 // leaving only disappeared or invalidated display items in the old list aft er painting.
668 m_newDisplayItemList.removeLast(); 668 m_newDisplayItemList.removeLast();
669 m_newDisplayItemList.appendByMoving(*oldItem); 669 m_newDisplayItemList.appendByMoving(*oldItem);
670 670
671 ++m_underInvalidationCheckingBegin; 671 ++m_underInvalidationCheckingBegin;
672 } 672 }
673 673
674 String PaintController::displayItemListAsDebugString(const DisplayItemList& list ) const 674 String PaintController::displayItemListAsDebugString(const DisplayItemList& list , bool showPictures) const
675 { 675 {
676 StringBuilder stringBuilder; 676 StringBuilder stringBuilder;
677 size_t i = 0; 677 size_t i = 0;
678 for (auto it = list.begin(); it != list.end(); ++it, ++i) { 678 for (auto it = list.begin(); it != list.end(); ++it, ++i) {
679 const DisplayItem& displayItem = *it; 679 const DisplayItem& displayItem = *it;
680 if (i) 680 if (i)
681 stringBuilder.append(",\n"); 681 stringBuilder.append(",\n");
682 stringBuilder.append(String::format("{index: %d, ", (int)i)); 682 stringBuilder.append(String::format("{index: %d, ", (int)i));
683 #ifndef NDEBUG 683 #ifndef NDEBUG
684 displayItem.dumpPropertiesAsDebugString(stringBuilder); 684 displayItem.dumpPropertiesAsDebugString(stringBuilder);
685 #else 685 #else
686 stringBuilder.append(String::format("clientDebugName: %s", displayItem.c lient().debugName().ascii().data())); 686 stringBuilder.append(String::format("clientDebugName: %s", displayItem.c lient().debugName().ascii().data()));
687 #endif 687 #endif
688 if (displayItem.hasValidClient()) { 688 if (displayItem.hasValidClient()) {
689 do { 689 do {
690 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 690 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
691 if (!displayItem.client().isAlive()) { 691 if (!displayItem.client().isAlive()) {
692 stringBuilder.append(", clientIsAlive: false"); 692 stringBuilder.append(", clientIsAlive: false");
693 break; 693 break;
694 } 694 }
695 #endif 695 #endif
696 stringBuilder.append(", cacheIsValid: "); 696 stringBuilder.append(", cacheIsValid: ");
697 stringBuilder.append(clientCacheIsValid(displayItem.client()) ? "true" : "false"); 697 stringBuilder.append(clientCacheIsValid(displayItem.client()) ? "true" : "false");
698 } while (false); 698 } while (false);
699 #ifndef NDEBUG
700 if (showPictures && displayItem.isDrawing()) {
701 if (const SkPicture* picture = static_cast<const DrawingDisplayI tem&>(displayItem).picture()) {
702 stringBuilder.append(", picture: ");
703 stringBuilder.append(pictureAsDebugString(picture));
704 }
705 }
706 #endif
699 } 707 }
700 if (list.hasVisualRect(i)) { 708 if (list.hasVisualRect(i)) {
701 IntRect visualRect = list.visualRect(i); 709 IntRect visualRect = list.visualRect(i);
702 stringBuilder.append(String::format(", visualRect: [%d,%d %dx%d]", 710 stringBuilder.append(String::format(", visualRect: [%d,%d %dx%d]",
703 visualRect.x(), visualRect.y(), 711 visualRect.x(), visualRect.y(),
704 visualRect.width(), visualRect.height())); 712 visualRect.width(), visualRect.height()));
705 } 713 }
706 stringBuilder.append('}'); 714 stringBuilder.append('}');
707 } 715 }
708 return stringBuilder.toString(); 716 return stringBuilder.toString();
709 } 717 }
710 718
711 void PaintController::showDebugData() const 719 void PaintController::showDebugDataInternal(bool showPictures) const
712 { 720 {
713 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); 721 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList(), showPictures).utf8().data());
714 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); 722 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList, showPictures).utf8().data());
715 } 723 }
716 724
717 } // namespace blink 725 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698