Title: [236087] trunk/Source/WebCore
Revision
236087
Author
[email protected]
Date
2018-09-17 15:05:42 -0700 (Mon, 17 Sep 2018)

Log Message

Add support for dumping the GraphicsLayer tree via notifyutil
https://bugs.webkit.org/show_bug.cgi?id=189639

Reviewed by Zalan Bujtas.

Make "notifyutil -p com.apple.WebKit.showGraphicsLayerTree" work. It dumps the GraphicsLayer tree
for each top-level document (GraphicsLayers are connected across frame boundaries, so this prints
the entire tree for each main frame).

It uses WTFLogAlways rather than fprintf() so output shows on all platforms (other tree dumps should
be converted in the same way).

* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize):
* platform/graphics/GraphicsLayer.cpp:
(showGraphicsLayerTree):
* rendering/RenderLayerCompositor.cpp:
(showGraphicsLayerTreeForCompositor):
* rendering/RenderLayerCompositor.h:
* rendering/RenderObject.cpp:
(WebCore::printGraphicsLayerTreeForLiveDocuments):
* rendering/RenderObject.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236086 => 236087)


--- trunk/Source/WebCore/ChangeLog	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/ChangeLog	2018-09-17 22:05:42 UTC (rev 236087)
@@ -1,3 +1,28 @@
+2018-09-14  Simon Fraser  <[email protected]>
+
+        Add support for dumping the GraphicsLayer tree via notifyutil
+        https://bugs.webkit.org/show_bug.cgi?id=189639
+
+        Reviewed by Zalan Bujtas.
+
+        Make "notifyutil -p com.apple.WebKit.showGraphicsLayerTree" work. It dumps the GraphicsLayer tree
+        for each top-level document (GraphicsLayers are connected across frame boundaries, so this prints
+        the entire tree for each main frame).
+        
+        It uses WTFLogAlways rather than fprintf() so output shows on all platforms (other tree dumps should
+        be converted in the same way).
+
+        * page/mac/PageMac.mm:
+        (WebCore::Page::platformInitialize):
+        * platform/graphics/GraphicsLayer.cpp:
+        (showGraphicsLayerTree):
+        * rendering/RenderLayerCompositor.cpp:
+        (showGraphicsLayerTreeForCompositor):
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::printGraphicsLayerTreeForLiveDocuments):
+        * rendering/RenderObject.h:
+
 2018-09-17  Christopher Reid  <[email protected]>
 
         [Curl] Add schema version and enable auto vacuum for cookie database.

Modified: trunk/Source/WebCore/page/mac/PageMac.mm (236086 => 236087)


--- trunk/Source/WebCore/page/mac/PageMac.mm	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/page/mac/PageMac.mm	2018-09-17 22:05:42 UTC (rev 236087)
@@ -58,6 +58,7 @@
 #if ENABLE(TREE_DEBUGGING)
         PAL::registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments);
         PAL::registerNotifyCallback("com.apple.WebKit.showLayerTree", printLayerTreeForLiveDocuments);
+        PAL::registerNotifyCallback("com.apple.WebKit.showGraphicsLayerTree", printGraphicsLayerTreeForLiveDocuments);
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
         PAL::registerNotifyCallback("com.apple.WebKit.showLayoutTree", Layout::printLayoutTreeForLiveDocuments);
 #endif

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (236086 => 236087)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2018-09-17 22:05:42 UTC (rev 236087)
@@ -980,6 +980,6 @@
         return;
 
     String output = layer->layerTreeAsText(WebCore::LayerTreeAsTextShowAll);
-    fprintf(stderr, "%s\n", output.utf8().data());
+    WTFLogAlways("%s\n", output.utf8().data());
 }
 #endif

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (236086 => 236087)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-09-17 22:05:42 UTC (rev 236087)
@@ -4146,3 +4146,10 @@
 }
 
 } // namespace WebCore
+
+#if ENABLE(TREE_DEBUGGING)
+void showGraphicsLayerTreeForCompositor(WebCore::RenderLayerCompositor& compositor)
+{
+    showGraphicsLayerTree(compositor.rootGraphicsLayer());
+}
+#endif

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (236086 => 236087)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2018-09-17 22:05:42 UTC (rev 236087)
@@ -580,3 +580,8 @@
 WTF::TextStream& operator<<(WTF::TextStream&, CompositingPolicy);
 
 } // namespace WebCore
+
+#if ENABLE(TREE_DEBUGGING)
+// Outside the WebCore namespace for ease of invocation from the debugger.
+void showGraphicsLayerTreeForCompositor(WebCore::RenderLayerCompositor&);
+#endif

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (236086 => 236087)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2018-09-17 22:05:42 UTC (rev 236087)
@@ -52,6 +52,7 @@
 #include "RenderIterator.h"
 #include "RenderLayer.h"
 #include "RenderLayerBacking.h"
+#include "RenderLayerCompositor.h"
 #include "RenderMultiColumnFlow.h"
 #include "RenderRuby.h"
 #include "RenderSVGBlock.h"
@@ -1937,6 +1938,18 @@
     }
 }
 
+void printGraphicsLayerTreeForLiveDocuments()
+{
+    for (const auto* document : Document::allDocuments()) {
+        if (!document->renderView())
+            continue;
+        if (document->frame() && document->frame()->isMainFrame()) {
+            WTFLogAlways("Graphics layer tree for root document %p %s", document, document->url().string().utf8().data());
+            showGraphicsLayerTreeForCompositor(document->renderView()->compositor());
+        }
+    }
+}
+
 #endif // ENABLE(TREE_DEBUGGING)
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderObject.h (236086 => 236087)


--- trunk/Source/WebCore/rendering/RenderObject.h	2018-09-17 21:59:33 UTC (rev 236086)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2018-09-17 22:05:42 UTC (rev 236087)
@@ -1103,6 +1103,7 @@
 #if ENABLE(TREE_DEBUGGING)
 void printRenderTreeForLiveDocuments();
 void printLayerTreeForLiveDocuments();
+void printGraphicsLayerTreeForLiveDocuments();
 #endif
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to