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( ...@@ -72,10 +72,10 @@ scoped_refptr<cc::PictureLayer> ContentLayerClientImpl::UpdateCcPictureLayer(
for (auto it = paint_chunks.begin(); it != paint_chunks.end(); ++it) { for (auto it = paint_chunks.begin(); it != paint_chunks.end(); ++it) {
auto json = std::make_unique<JSONObject>(); auto json = std::make_unique<JSONObject>();
json->SetString("data", it->ToString()); json->SetString("data", it->ToString());
json->SetArray( json->SetArray("displayItems",
"displayItems", DisplayItemList::DisplayItemsAsJSON(
DisplayItemList::DisplayItemsAsJSON( it->begin_index, it.DisplayItems(),
it.DisplayItems(), DisplayItemList::kShowOnlyDisplayItemTypes)); DisplayItemList::kShowOnlyDisplayItemTypes));
paint_chunk_debug_data_->PushObject(std::move(json)); paint_chunk_debug_data_->PushObject(std::move(json));
} }
#endif #endif
......
...@@ -12,6 +12,7 @@ namespace blink { ...@@ -12,6 +12,7 @@ namespace blink {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON( std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON(
wtf_size_t first_item_index,
const DisplayItemRange& display_items, const DisplayItemRange& display_items,
JsonFlags flags) { JsonFlags flags) {
auto json_array = std::make_unique<JSONArray>(); auto json_array = std::make_unique<JSONArray>();
...@@ -23,7 +24,7 @@ std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON( ...@@ -23,7 +24,7 @@ std::unique_ptr<JSONArray> DisplayItemList::DisplayItemsAsJSON(
for (auto& item : display_items) for (auto& item : display_items)
json_array->PushString(item.GetId().ToString()); json_array->PushString(item.GetId().ToString());
} else { } else {
int i = 0; wtf_size_t i = first_item_index;
for (auto& item : display_items) { for (auto& item : display_items) {
auto json = std::make_unique<JSONObject>(); auto json = std::make_unique<JSONObject>();
......
...@@ -112,6 +112,7 @@ class PLATFORM_EXPORT DisplayItemList ...@@ -112,6 +112,7 @@ class PLATFORM_EXPORT DisplayItemList
typedef unsigned JsonFlags; typedef unsigned JsonFlags;
static std::unique_ptr<JSONArray> DisplayItemsAsJSON( static std::unique_ptr<JSONArray> DisplayItemsAsJSON(
wtf_size_t first_item_index,
const Range<const_iterator>& display_items, const Range<const_iterator>& display_items,
JsonFlags); JsonFlags);
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
......
...@@ -118,9 +118,10 @@ void PaintController::PaintArtifactAsJSON::AppendChunksAsJSON( ...@@ -118,9 +118,10 @@ void PaintController::PaintArtifactAsJSON::AppendChunksAsJSON(
if (flags_ & DisplayItemList::kShowPaintRecords) if (flags_ & DisplayItemList::kShowPaintRecords)
json_object->SetString("chunkData", chunk.ToString()); json_object->SetString("chunkData", chunk.ToString());
json_object->SetArray("displayItems", json_object->SetArray(
DisplayItemList::DisplayItemsAsJSON( "displayItems",
artifact_.DisplayItemsInChunk(i), flags_)); DisplayItemList::DisplayItemsAsJSON(
chunk.begin_index, artifact_.DisplayItemsInChunk(i), flags_));
json_array.PushObject(std::move(json_object)); 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