Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 2577123002: Add optional debugging output of what paint chunks go into what layers. (Closed)
Patch Set: none Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
index 8d806185ea613b1080d1b2ed67c115f353f71468..a6ab798f344de8be6f12f48c5959530b344d7126 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -77,6 +77,11 @@ class PaintArtifactCompositor::ContentLayerClientImpl
}
void SetPaintableRegion(gfx::Rect region) { m_paintableRegion = region; }
+ void addPaintChunkDebugData(std::unique_ptr<JSONArray> json) {
+ m_paintChunkDebugData.append(std::move(json));
+ }
+ void clearPaintChunkDebugData() { m_paintChunkDebugData.clear(); }
+
// cc::ContentLayerClient
gfx::Rect PaintableRegion() override { return m_paintableRegion; }
scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList(
@@ -130,7 +135,7 @@ class PaintArtifactCompositor::ContentLayerClientImpl
}
}
- std::unique_ptr<JSONObject> layerAsJSON() {
+ std::unique_ptr<JSONObject> layerAsJSON(LayerTreeFlags flags) {
std::unique_ptr<JSONObject> json = JSONObject::create();
json->setString("name", m_debugName);
IntSize bounds(m_ccPictureLayer->bounds().width(),
@@ -140,6 +145,14 @@ class PaintArtifactCompositor::ContentLayerClientImpl
json->setBoolean("contentsOpaque", m_ccPictureLayer->contents_opaque());
json->setBoolean("drawsContent", m_ccPictureLayer->DrawsContent());
+ if (flags & LayerTreeIncludesDebugInfo) {
+ std::unique_ptr<JSONArray> paintChunkContentsArray = JSONArray::create();
+ for (const auto& debugData : m_paintChunkDebugData) {
+ paintChunkContentsArray->pushValue(debugData->clone());
+ }
+ json->setArray("paintChunkContents", std::move(paintChunkContentsArray));
+ }
+
ccLayersRasterInvalidationTrackingMap().asJSON(m_ccPictureLayer.get(),
json.get());
return json;
@@ -157,6 +170,7 @@ class PaintArtifactCompositor::ContentLayerClientImpl
scoped_refptr<cc::PictureLayer> m_ccPictureLayer;
scoped_refptr<cc::DisplayItemList> m_ccDisplayItemList;
gfx::Rect m_paintableRegion;
+ Vector<std::unique_ptr<JSONArray>> m_paintChunkDebugData;
};
PaintArtifactCompositor::PaintArtifactCompositor() {
@@ -193,7 +207,7 @@ std::unique_ptr<JSONObject> PaintArtifactCompositor::layersAsJSON(
LayerTreeFlags flags) const {
std::unique_ptr<JSONArray> layersJSON = JSONArray::create();
for (const auto& client : m_contentLayerClients) {
- layersJSON->pushObject(client->layerAsJSON());
+ layersJSON->pushObject(client->layerAsJSON(flags));
}
std::unique_ptr<JSONObject> json = JSONObject::create();
json->setArray("layers", std::move(layersJSON));
@@ -301,7 +315,8 @@ scoped_refptr<cc::Layer> PaintArtifactCompositor::layerForPaintChunk(
const PaintChunk& paintChunk,
gfx::Vector2dF& layerOffset,
Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients,
- RasterInvalidationTracking* tracking) {
+ RasterInvalidationTracking* tracking,
+ bool storeDebugInfo) {
DCHECK(paintChunk.size());
// If the paint chunk is a foreign layer, just return that layer.
@@ -329,6 +344,16 @@ scoped_refptr<cc::Layer> PaintArtifactCompositor::layerForPaintChunk(
DCHECK(!tracking ||
tracking->trackedRasterInvalidations.size() ==
paintChunk.rasterInvalidationRects.size());
+
+ contentLayerClient->clearPaintChunkDebugData();
+ if (storeDebugInfo) {
+ contentLayerClient->addPaintChunkDebugData(
+ paintArtifact.getDisplayItemList().subsequenceAsJSON(
+ paintChunk.beginIndex, paintChunk.endIndex,
+ DisplayItemList::SkipNonDrawings |
+ DisplayItemList::ShownOnlyDisplayItemTypes));
+ }
+
for (unsigned index = 0; index < paintChunk.rasterInvalidationRects.size();
++index) {
IntRect rect(enclosingIntRect(paintChunk.rasterInvalidationRects[index]));
@@ -768,7 +793,8 @@ void PropertyTreeManager::buildEffectNodesRecursively(
void PaintArtifactCompositor::update(
const PaintArtifact& paintArtifact,
- RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations) {
+ RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations,
+ bool storeDebugInfo) {
DCHECK(m_rootLayer);
cc::LayerTree* layerTree = m_rootLayer->GetLayerTree();
@@ -794,7 +820,8 @@ void PaintArtifactCompositor::update(
scoped_refptr<cc::Layer> layer = layerForPaintChunk(
paintArtifact, paintChunk, layerOffset, newContentLayerClients,
rasterChunkInvalidations ? rasterChunkInvalidations->find(&paintChunk)
- : nullptr);
+ : nullptr,
+ storeDebugInfo);
int transformId = propertyTreeManager.compositorIdForTransformNode(
paintChunk.properties.propertyTreeState.transform());

Powered by Google App Engine
This is Rietveld 408576698