| 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/tracing/TraceEvent.h" | 9 #include "platform/tracing/TraceEvent.h" |
| 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 // m_newDisplayItemList. This is to align with the | 819 // m_newDisplayItemList. This is to align with the |
| 820 // non-under-invalidation-checking path to empty the original cached slot, | 820 // non-under-invalidation-checking path to empty the original cached slot, |
| 821 // leaving only disappeared or invalidated display items in the old list after | 821 // leaving only disappeared or invalidated display items in the old list after |
| 822 // painting. | 822 // painting. |
| 823 m_newDisplayItemList.removeLast(); | 823 m_newDisplayItemList.removeLast(); |
| 824 moveItemFromCurrentListToNewList(oldItemIndex); | 824 moveItemFromCurrentListToNewList(oldItemIndex); |
| 825 | 825 |
| 826 ++m_underInvalidationCheckingBegin; | 826 ++m_underInvalidationCheckingBegin; |
| 827 } | 827 } |
| 828 | 828 |
| 829 String PaintController::displayItemListAsDebugString( | |
| 830 const DisplayItemList& list, | |
| 831 bool showPictures) const { | |
| 832 StringBuilder stringBuilder; | |
| 833 size_t i = 0; | |
| 834 for (auto it = list.begin(); it != list.end(); ++it, ++i) { | |
| 835 const DisplayItem& displayItem = *it; | |
| 836 if (i) | |
| 837 stringBuilder.append(",\n"); | |
| 838 stringBuilder.append(String::format("{index: %zu, ", i)); | |
| 839 #ifndef NDEBUG | |
| 840 displayItem.dumpPropertiesAsDebugString(stringBuilder); | |
| 841 #endif | |
| 842 | |
| 843 if (displayItem.hasValidClient()) { | |
| 844 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | |
| 845 if (!displayItem.client().isAlive()) { | |
| 846 stringBuilder.append(", clientIsAlive: false"); | |
| 847 } else { | |
| 848 #else | |
| 849 // debugName() and clientCacheIsValid() can only be called on a live | |
| 850 // client, so only output it for m_newDisplayItemList, in which we are | |
| 851 // sure the clients are all alive. | |
| 852 if (&list == &m_newDisplayItemList) { | |
| 853 #endif | |
| 854 #ifdef NDEBUG | |
| 855 stringBuilder.append( | |
| 856 String::format("clientDebugName: \"%s\"", | |
| 857 displayItem.client().debugName().ascii().data())); | |
| 858 #endif | |
| 859 stringBuilder.append(", cacheIsValid: "); | |
| 860 stringBuilder.append( | |
| 861 clientCacheIsValid(displayItem.client()) ? "true" : "false"); | |
| 862 } | |
| 863 #ifndef NDEBUG | |
| 864 if (showPictures && displayItem.isDrawing()) { | |
| 865 if (const SkPicture* picture = | |
| 866 static_cast<const DrawingDisplayItem&>(displayItem).picture()) { | |
| 867 stringBuilder.append(", picture: "); | |
| 868 stringBuilder.append(pictureAsDebugString(picture)); | |
| 869 } | |
| 870 } | |
| 871 #endif | |
| 872 } | |
| 873 if (list.hasVisualRect(i)) { | |
| 874 IntRect visualRect = list.visualRect(i); | |
| 875 stringBuilder.append(String::format( | |
| 876 ", visualRect: [%d,%d %dx%d]", visualRect.x(), visualRect.y(), | |
| 877 visualRect.width(), visualRect.height())); | |
| 878 } | |
| 879 stringBuilder.append('}'); | |
| 880 } | |
| 881 return stringBuilder.toString(); | |
| 882 } | |
| 883 | |
| 884 void PaintController::showDebugDataInternal(bool showPictures) const { | 829 void PaintController::showDebugDataInternal(bool showPictures) const { |
| 885 WTFLogAlways("current display item list: [%s]\n", | 830 WTFLogAlways("current display item list: [%s]\n", |
| 886 displayItemListAsDebugString( | 831 m_currentPaintArtifact.getDisplayItemList() |
| 887 m_currentPaintArtifact.getDisplayItemList(), showPictures) | 832 .subsequenceAsJSON( |
| 833 0, m_currentPaintArtifact.getDisplayItemList().size(), |
| 834 showPictures, false) |
| 835 ->toPrettyJSONString() |
| 888 .utf8() | 836 .utf8() |
| 889 .data()); | 837 .data()); |
| 890 WTFLogAlways("new display item list: [%s]\n", | 838 WTFLogAlways("new display item list: [%s]\n", |
| 891 displayItemListAsDebugString(m_newDisplayItemList, showPictures) | 839 m_newDisplayItemList |
| 840 .subsequenceAsJSON(0, m_newDisplayItemList.size(), |
| 841 showPictures, false) |
| 842 ->toPrettyJSONString() |
| 892 .utf8() | 843 .utf8() |
| 893 .data()); | 844 .data()); |
| 894 } | 845 } |
| 895 | 846 |
| 896 } // namespace blink | 847 } // namespace blink |
| OLD | NEW |