Commit 59e86b24 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Use global display item index in DisplayItemList dump

The global display item indices (in the whole DisplayItemList) are more
meaningful than the previous local indices (in DisplayItemRanges, which
are in PaintChunks in the output of ShowDebugData) because we use the
former in PaintController logic.

Change-Id: I40c6d12bbf99d0f9fbfbbfa19050e75bd6cf2a09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2483584
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818659}
parent aa07aab6
......@@ -72,10 +72,10 @@ scoped_refptr<cc::PictureLayer> ContentLayerClientImpl::UpdateCcPictureLayer(
for (auto it = paint_chunks.begin(); it != paint_chunks.end(); ++it) {
auto json = std::make_unique<JSONObject>();
json->SetString("data", it->ToString());
json->SetArray(
"displayItems",
json->SetArray("displayItems",
DisplayItemList::DisplayItemsAsJSON(
it.DisplayItems(), DisplayItemList::kShowOnlyDisplayItemTypes));
it->begin_index, it.DisplayItems(),
DisplayItemList::kShowOnlyDisplayItemTypes));
paint_chunk_debug_data_->PushObject(std::move(json));
}
#endif
......
......@@ -12,6 +12,7 @@ namespace blink {
#if DCHECK_IS_ON()
std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON(
wtf_size_t first_item_index,
const DisplayItemRange& display_items,
JsonFlags flags) {
auto json_array = std::make_unique<JSONArray>();
......@@ -23,7 +24,7 @@ std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON(
for (auto& item : display_items)
json_array->PushString(item.GetId().ToString());
} else {
int i = 0;
wtf_size_t i = first_item_index;
for (auto& item : display_items) {
auto json = std::make_unique<JSONObject>();
......
......@@ -112,6 +112,7 @@ class PLATFORM_EXPORT DisplayItemList
typedef unsigned JsonFlags;
static std::unique_ptr<JSONArray> DisplayItemsAsJSON(
wtf_size_t first_item_index,
const Range<const_iterator>& display_items,
JsonFlags);
#endif // DCHECK_IS_ON()
......
......@@ -118,9 +118,10 @@ void PaintController::PaintArtifactAsJSON::AppendChunksAsJSON(
if (flags_ & DisplayItemList::kShowPaintRecords)
json_object->SetString("chunkData", chunk.ToString());
json_object->SetArray("displayItems",
json_object->SetArray(
"displayItems",
DisplayItemList::DisplayItemsAsJSON(
artifact_.DisplayItemsInChunk(i), flags_));
chunk.begin_index, artifact_.DisplayItemsInChunk(i), flags_));
json_array.PushObject(std::move(json_object));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment