OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/DisplayItemList.h" | 5 #include "platform/graphics/paint/DisplayItemList.h" |
6 | 6 |
7 #include "platform/graphics/LoggingCanvas.h" | 7 #include "platform/graphics/LoggingCanvas.h" |
8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
9 #include "platform/graphics/paint/PaintChunk.h" | 9 #include "platform/graphics/paint/PaintChunk.h" |
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 std::unique_ptr<JSONObject> json = JSONObject::create(); | 59 std::unique_ptr<JSONObject> json = JSONObject::create(); |
60 | 60 |
61 const DisplayItem& displayItem = *it; | 61 const DisplayItem& displayItem = *it; |
62 if ((options & SkipNonDrawings) && !displayItem.isDrawing()) | 62 if ((options & SkipNonDrawings) && !displayItem.isDrawing()) |
63 continue; | 63 continue; |
64 | 64 |
65 json->setInteger("index", i); | 65 json->setInteger("index", i); |
66 #ifndef NDEBUG | 66 #ifndef NDEBUG |
67 StringBuilder stringBuilder; | 67 StringBuilder stringBuilder; |
68 displayItem.dumpPropertiesAsDebugString(stringBuilder); | 68 displayItem.dumpPropertiesAsDebugString(stringBuilder); |
69 json->setString("properties", stringBuilder.toString()); | 69 |
| 70 if (options & ShownOnlyDisplayItemTypes) { |
| 71 json->setString("type", |
| 72 DisplayItem::typeAsDebugString(displayItem.getType())); |
| 73 } else { |
| 74 json->setString("properties", stringBuilder.toString()); |
| 75 } |
| 76 |
70 #endif | 77 #endif |
71 if (displayItem.hasValidClient()) { | 78 if (displayItem.hasValidClient()) { |
72 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 79 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
73 if (!displayItem.client().isAlive()) { | 80 if (!displayItem.client().isAlive()) { |
74 json->setBoolean("clientIsAlive", true); | 81 json->setBoolean("clientIsAlive", true); |
75 } else { | 82 } else { |
76 #else | 83 #else |
77 | 84 |
78 if (options & ShowClientDebugName) { | 85 if (options & ShowClientDebugName) { |
79 #endif | 86 #endif |
80 #ifdef NDEBUG | |
81 json->setString( | 87 json->setString( |
82 "clientDebugName", | 88 "clientDebugName", |
83 String::format("clientDebugName: \"%s\"", | 89 String::format("clientDebugName: \"%s\"", |
84 displayItem.client().debugName().ascii().data())); | 90 displayItem.client().debugName().ascii().data())); |
85 #endif | |
86 } | 91 } |
87 #ifndef NDEBUG | 92 #ifndef NDEBUG |
88 if ((options & ShowPictures) && displayItem.isDrawing()) { | 93 if ((options & ShowPictures) && displayItem.isDrawing()) { |
89 if (const SkPicture* picture = | 94 if (const SkPicture* picture = |
90 static_cast<const DrawingDisplayItem&>(displayItem).picture()) { | 95 static_cast<const DrawingDisplayItem&>(displayItem).picture()) { |
91 json->setString("picture", pictureAsDebugString(picture)); | 96 json->setString("picture", pictureAsDebugString(picture)); |
92 } | 97 } |
93 } | 98 } |
94 #endif | 99 #endif |
95 } | 100 } |
96 if (hasVisualRect(i)) { | 101 if (hasVisualRect(i)) { |
97 IntRect localVisualRect = visualRect(i); | 102 IntRect localVisualRect = visualRect(i); |
98 json->setString( | 103 json->setString( |
99 "visualRect", | 104 "visualRect", |
100 String::format("[%d,%d %dx%d]", localVisualRect.x(), | 105 String::format("[%d,%d %dx%d]", localVisualRect.x(), |
101 localVisualRect.y(), localVisualRect.width(), | 106 localVisualRect.y(), localVisualRect.width(), |
102 localVisualRect.height())); | 107 localVisualRect.height())); |
103 } | 108 } |
104 jsonArray->pushObject(std::move(json)); | 109 jsonArray->pushObject(std::move(json)); |
105 } | 110 } |
106 return jsonArray; | 111 return jsonArray; |
107 } | 112 } |
108 | 113 |
109 } // namespace blink | 114 } // namespace blink |
OLD | NEW |