Title: [199068] trunk/Source/WebCore
Revision
199068
Author
[email protected]
Date
2016-04-05 12:40:07 -0700 (Tue, 05 Apr 2016)

Log Message

Add a "notifyutil" callback for dumping the RenderLayer tree, and move the registration to Page code
https://bugs.webkit.org/show_bug.cgi?id=156224

Reviewed by Zalan Bujtas.

Make it possible to run:
    notifyutil -p com.apple.WebKit.showLayerTree
on the command line and have it dump out layer trees for all live documents, in
debug builds.

Move callback registration from RenderObject's constructor to Page.

* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize):
* rendering/RenderObject.cpp:
(WebCore::printLayerTreeForLiveDocuments):
(WebCore::RenderObject::RenderObject): Deleted.
* rendering/RenderObject.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199067 => 199068)


--- trunk/Source/WebCore/ChangeLog	2016-04-05 19:38:49 UTC (rev 199067)
+++ trunk/Source/WebCore/ChangeLog	2016-04-05 19:40:07 UTC (rev 199068)
@@ -1,3 +1,24 @@
+2016-04-05  Simon Fraser  <[email protected]>
+
+        Add a "notifyutil" callback for dumping the RenderLayer tree, and move the registration to Page code
+        https://bugs.webkit.org/show_bug.cgi?id=156224
+
+        Reviewed by Zalan Bujtas.
+
+        Make it possible to run:
+            notifyutil -p com.apple.WebKit.showLayerTree
+        on the command line and have it dump out layer trees for all live documents, in
+        debug builds.
+        
+        Move callback registration from RenderObject's constructor to Page.
+
+        * page/mac/PageMac.mm:
+        (WebCore::Page::platformInitialize):
+        * rendering/RenderObject.cpp:
+        (WebCore::printLayerTreeForLiveDocuments):
+        (WebCore::RenderObject::RenderObject): Deleted.
+        * rendering/RenderObject.h:
+
 2016-04-05  Antoine Quint  <[email protected]>
 
         [WebGL2] Turn the ENABLE_WEBGL2 flag on

Modified: trunk/Source/WebCore/page/mac/PageMac.mm (199067 => 199068)


--- trunk/Source/WebCore/page/mac/PageMac.mm	2016-04-05 19:38:49 UTC (rev 199067)
+++ trunk/Source/WebCore/page/mac/PageMac.mm	2016-04-05 19:40:07 UTC (rev 199068)
@@ -32,7 +32,9 @@
 #import "DocumentLoader.h"
 #import "FrameLoader.h"
 #import "FrameTree.h"
+#import "Logging.h"
 #import "MainFrame.h"
+#import "RenderObject.h"
 
 #if PLATFORM(IOS)
 #import "WebCoreThread.h"
@@ -51,6 +53,14 @@
 #else
     addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes));
 #endif
+
+#if ENABLE(TREE_DEBUGGING)
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [] {
+        registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments);
+        registerNotifyCallback("com.apple.WebKit.showLayerTree", printLayerTreeForLiveDocuments);
+    });
+#endif
 }
 
 void Page::addSchedulePair(Ref<SchedulePair>&& pair)

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (199067 => 199068)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2016-04-05 19:38:49 UTC (rev 199067)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2016-04-05 19:40:07 UTC (rev 199068)
@@ -43,7 +43,6 @@
 #include "HTMLTableCellElement.h"
 #include "HTMLTableElement.h"
 #include "HitTestResult.h"
-#include "Logging.h"
 #include "LogicalSelectionOffsetCaches.h"
 #include "MainFrame.h"
 #include "Page.h"
@@ -84,7 +83,6 @@
 using namespace HTMLNames;
 
 #ifndef NDEBUG
-void printRenderTreeForLiveDocuments();
 
 RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(RenderObject* renderObject, bool isForbidden)
     : m_renderObject(renderObject)
@@ -128,10 +126,6 @@
         renderView->didCreateRenderer();
 #ifndef NDEBUG
     renderObjectCounter.increment();
-    static std::once_flag onceFlag;
-    std::call_once(onceFlag, [] {
-        registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments);
-    });
 #endif
 }
 
@@ -2277,7 +2271,8 @@
     setHasRareData(false);
 }
 
-#ifndef NDEBUG
+#if ENABLE(TREE_DEBUGGING)
+
 void printRenderTreeForLiveDocuments()
 {
     for (const auto* document : Document::allDocuments()) {
@@ -2289,7 +2284,21 @@
         showRenderTree(document->renderView());
     }
 }
-#endif
+
+void printLayerTreeForLiveDocuments()
+{
+    for (const auto* document : Document::allDocuments()) {
+        if (!document->renderView() || document->inPageCache())
+            continue;
+        if (document->frame() && document->frame()->isMainFrame())
+            fprintf(stderr, "----------------------main frame--------------------------\n");
+        fprintf(stderr, "%s", document->url().string().utf8().data());
+        showLayerTree(document->renderView());
+    }
+}
+
+#endif // ENABLE(TREE_DEBUGGING)
+
 } // namespace WebCore
 
 #if ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/rendering/RenderObject.h (199067 => 199068)


--- trunk/Source/WebCore/rendering/RenderObject.h	2016-04-05 19:38:49 UTC (rev 199067)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2016-04-05 19:40:07 UTC (rev 199068)
@@ -1152,6 +1152,11 @@
     return m_bitfields.boxDecorationState() == HasBoxDecorationsAndBackgroundIsKnownToBeObscured;
 }
 
+#if ENABLE(TREE_DEBUGGING)
+void printRenderTreeForLiveDocuments();
+void printLayerTreeForLiveDocuments();
+#endif
+
 } // namespace WebCore
 
 #define SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(ToValueTypeName, predicate) \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to