| Index: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
|
| index a2030fb7c4bac6bc126726929ec7aadba9ee1ed9..84e0d961c05b766095791bf9d4ff1c34a18e12cb 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.cpp
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "platform/graphics/paint/DisplayItemList.h"
|
|
|
| +#include "platform/graphics/LoggingCanvas.h"
|
| #include "platform/graphics/paint/DrawingDisplayItem.h"
|
| #include "platform/graphics/paint/PaintChunk.h"
|
| #include "third_party/skia/include/core/SkPictureAnalyzer.h"
|
| @@ -48,4 +49,69 @@ DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const {
|
| begin() + paintChunk.endIndex);
|
| }
|
|
|
| +std::unique_ptr<JSONArray> DisplayItemList::subsequenceAsJSON(
|
| + size_t beginIndex,
|
| + size_t endIndex,
|
| + bool showPictures,
|
| + bool skipNonDrawings) const {
|
| + std::unique_ptr<JSONArray> jsonArray = JSONArray::create();
|
| + size_t i = 0;
|
| + for (auto it = begin(); it != end(); ++it, ++i) {
|
| + std::unique_ptr<JSONObject> json = JSONObject::create();
|
| + if (i < beginIndex || i >= endIndex)
|
| + continue;
|
| +
|
| + const DisplayItem& displayItem = *it;
|
| + if (skipNonDrawings && !displayItem.isDrawing())
|
| + continue;
|
| +
|
| + if (!skipNonDrawings)
|
| + json->setInteger("index", i);
|
| +#ifndef NDEBUG
|
| + StringBuilder stringBuilder;
|
| + displayItem.dumpPropertiesAsDebugString(stringBuilder);
|
| + json->setString("properties", stringBuilder.toString());
|
| +#endif
|
| +
|
| + if (displayItem.hasValidClient()) {
|
| +#if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
|
| + if (!displayItem.client().isAlive()) {
|
| + json->setBoolean("clientIsAlive", true);
|
| + } else {
|
| +#else
|
| + // debugName() and clientCacheIsValid() can only be called on a live
|
| + // client, so only output it for m_newDisplayItemList, in which we are
|
| + // sure the clients are all alive.
|
| + if (&list == &m_newDisplayItemList) {
|
| +#endif
|
| +#ifdef NDEBUG
|
| + json->setString(
|
| + "clientDebugName",
|
| + String::format("clientDebugName: \"%s\"",
|
| + displayItem.client().debugName().ascii().data()));
|
| +#endif
|
| + }
|
| +#ifndef NDEBUG
|
| + if (showPictures && displayItem.isDrawing()) {
|
| + if (const SkPicture* picture =
|
| + static_cast<const DrawingDisplayItem&>(displayItem).picture()) {
|
| + json->setString("picture", pictureAsDebugString(picture));
|
| + }
|
| + }
|
| +#endif
|
| + }
|
| + if (hasVisualRect(i)) {
|
| + IntRect localVisualRect = visualRect(i);
|
| + json->setString(
|
| + "visualRect",
|
| + String::format("[%d,%d %dx%d]", localVisualRect.x(),
|
| + localVisualRect.y(), localVisualRect.width(),
|
| + localVisualRect.height()));
|
| + }
|
| +
|
| + jsonArray->pushObject(std::move(json));
|
| + }
|
| + return jsonArray;
|
| +}
|
| +
|
| } // namespace blink
|
|
|