Changeset 199068 in webkit


Ignore:
Timestamp:
Apr 5, 2016 12:40:07 PM (8 years ago)
Author:
Simon Fraser
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:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199062 r199068  
     12016-04-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add a "notifyutil" callback for dumping the RenderLayer tree, and move the registration to Page code
     4        https://bugs.webkit.org/show_bug.cgi?id=156224
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Make it possible to run:
     9            notifyutil -p com.apple.WebKit.showLayerTree
     10        on the command line and have it dump out layer trees for all live documents, in
     11        debug builds.
     12       
     13        Move callback registration from RenderObject's constructor to Page.
     14
     15        * page/mac/PageMac.mm:
     16        (WebCore::Page::platformInitialize):
     17        * rendering/RenderObject.cpp:
     18        (WebCore::printLayerTreeForLiveDocuments):
     19        (WebCore::RenderObject::RenderObject): Deleted.
     20        * rendering/RenderObject.h:
     21
    1222016-04-05  Antoine Quint  <graouts@apple.com>
    223
  • trunk/Source/WebCore/page/mac/PageMac.mm

    r194472 r199068  
    3333#import "FrameLoader.h"
    3434#import "FrameTree.h"
     35#import "Logging.h"
    3536#import "MainFrame.h"
     37#import "RenderObject.h"
    3638
    3739#if PLATFORM(IOS)
     
    5153#else
    5254    addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes));
     55#endif
     56
     57#if ENABLE(TREE_DEBUGGING)
     58    static std::once_flag onceFlag;
     59    std::call_once(onceFlag, [] {
     60        registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments);
     61        registerNotifyCallback("com.apple.WebKit.showLayerTree", printLayerTreeForLiveDocuments);
     62    });
    5363#endif
    5464}
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r198701 r199068  
    4444#include "HTMLTableElement.h"
    4545#include "HitTestResult.h"
    46 #include "Logging.h"
    4746#include "LogicalSelectionOffsetCaches.h"
    4847#include "MainFrame.h"
     
    8584
    8685#ifndef NDEBUG
    87 void printRenderTreeForLiveDocuments();
    8886
    8987RenderObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(RenderObject* renderObject, bool isForbidden)
     
    129127#ifndef NDEBUG
    130128    renderObjectCounter.increment();
    131     static std::once_flag onceFlag;
    132     std::call_once(onceFlag, [] {
    133         registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments);
    134     });
    135129#endif
    136130}
     
    22782272}
    22792273
    2280 #ifndef NDEBUG
     2274#if ENABLE(TREE_DEBUGGING)
     2275
    22812276void printRenderTreeForLiveDocuments()
    22822277{
     
    22902285    }
    22912286}
     2287
     2288void printLayerTreeForLiveDocuments()
     2289{
     2290    for (const auto* document : Document::allDocuments()) {
     2291        if (!document->renderView() || document->inPageCache())
     2292            continue;
     2293        if (document->frame() && document->frame()->isMainFrame())
     2294            fprintf(stderr, "----------------------main frame--------------------------\n");
     2295        fprintf(stderr, "%s", document->url().string().utf8().data());
     2296        showLayerTree(document->renderView());
     2297    }
     2298}
     2299
     2300#endif // ENABLE(TREE_DEBUGGING)
     2301
     2302} // namespace WebCore
     2303
     2304#if ENABLE(TREE_DEBUGGING)
     2305
     2306void showNodeTree(const WebCore::RenderObject* object)
     2307{
     2308    if (!object)
     2309        return;
     2310    object->showNodeTreeForThis();
     2311}
     2312
     2313void showLineTree(const WebCore::RenderObject* object)
     2314{
     2315    if (!object)
     2316        return;
     2317    object->showLineTreeForThis();
     2318}
     2319
     2320void showRenderTree(const WebCore::RenderObject* object)
     2321{
     2322    if (!object)
     2323        return;
     2324    object->showRenderTreeForThis();
     2325}
     2326
    22922327#endif
    2293 } // namespace WebCore
    2294 
    2295 #if ENABLE(TREE_DEBUGGING)
    2296 
    2297 void showNodeTree(const WebCore::RenderObject* object)
    2298 {
    2299     if (!object)
    2300         return;
    2301     object->showNodeTreeForThis();
    2302 }
    2303 
    2304 void showLineTree(const WebCore::RenderObject* object)
    2305 {
    2306     if (!object)
    2307         return;
    2308     object->showLineTreeForThis();
    2309 }
    2310 
    2311 void showRenderTree(const WebCore::RenderObject* object)
    2312 {
    2313     if (!object)
    2314         return;
    2315     object->showRenderTreeForThis();
    2316 }
    2317 
    2318 #endif
  • trunk/Source/WebCore/rendering/RenderObject.h

    r198998 r199068  
    11531153}
    11541154
     1155#if ENABLE(TREE_DEBUGGING)
     1156void printRenderTreeForLiveDocuments();
     1157void printLayerTreeForLiveDocuments();
     1158#endif
     1159
    11551160} // namespace WebCore
    11561161
Note: See TracChangeset for help on using the changeset viewer.