Changeset 168433 in webkit


Ignore:
Timestamp:
May 7, 2014, 11:42:53 AM (11 years ago)
Author:
Simon Fraser
Message:

Add scrolling tree logging to RemoteLayerTree output
https://bugs.webkit.org/show_bug.cgi?id=132640

Reviewed by Beth Dakin.

Source/WebCore:

Support scrolling tree logging in the RemoteLayerTree log channel
output.

ScrollingStateTree::commit() unconditionally set treeStateClone->m_hasChangedProperties
to true, but we should set it based on original scrolling state tree's
m_hasChangedProperties.

We have to encode all of the scrolling state nodes anyway (they only encode
changed properties), but we can use this for future optimizations, and to
avoid spurious logging.

  • WebCore.exp.in: Export a couple of things we need.
  • page/scrolling/ScrollingStateTree.cpp:

(WebCore::ScrollingStateTree::commit):

Source/WebKit2:

Support scrolling tree logging in the RemoteLayerTree log channel
output.

Encode/decode ScrollingStateTree::hasChangedProperties() so we can use
it to avoid logging. Log all the things.

  • Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:

(WebKit::RemoteScrollingCoordinatorTransaction::encode):
(WebKit::RemoteScrollingCoordinatorTransaction::decode):
(WebKit::RemoteScrollingTreeTextStream::RemoteScrollingTreeTextStream):
(WebKit::RemoteScrollingTreeTextStream::increaseIndent):
(WebKit::RemoteScrollingTreeTextStream::decreaseIndent):
(WebKit::RemoteScrollingTreeTextStream::writeIndent):
(WebKit::dumpProperty):
(WebKit::RemoteScrollingTreeTextStream::operator<<):
(WebKit::RemoteScrollingTreeTextStream::dump):
(WebKit::RemoteScrollingTreeTextStream::recursiveDumpNodes):
(WebKit::RemoteScrollingCoordinatorTransaction::description):
(WebKit::RemoteScrollingCoordinatorTransaction::dump):

  • Shared/Scrolling/RemoteScrollingCoordinatorTransaction.h:
  • UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r168432 r168433  
     12014-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add scrolling tree logging to RemoteLayerTree output
     4        https://bugs.webkit.org/show_bug.cgi?id=132640
     5
     6        Reviewed by Beth Dakin.
     7
     8        Support scrolling tree logging in the RemoteLayerTree log channel
     9        output.
     10       
     11        ScrollingStateTree::commit() unconditionally set treeStateClone->m_hasChangedProperties
     12        to true, but we should set it based on original scrolling state tree's
     13        m_hasChangedProperties.
     14       
     15        We have to encode all of the scrolling state nodes anyway (they only encode
     16        changed properties), but we can use this for future optimizations, and to
     17        avoid spurious logging.
     18       
     19        * WebCore.exp.in: Export a couple of things we need.
     20        * page/scrolling/ScrollingStateTree.cpp:
     21        (WebCore::ScrollingStateTree::commit):
     22
    1232014-05-07  Chris Fleizach  <cfleizach@apple.com>
    224
  • trunk/Source/WebCore/WebCore.exp.in

    r168423 r168433  
    108108__ZN7WebCore10TextStreamlsEPKv
    109109__ZN7WebCore10TextStreamlsERKN3WTF6StringE
     110__ZN7WebCore10TextStreamlsERKNS_10FloatPointE
    110111__ZN7WebCore10TextStreamlsERKNS_8IntPointE
    111112__ZN7WebCore10TextStreamlsERKNS_9FloatSizeE
     
    27762777__ZN7WebCore18ScrollingStateTree14stateNodeForIDEy
    27772778__ZN7WebCore18ScrollingStateTree15setRemovedNodesEN3WTF6VectorIyLm0ENS1_15CrashOnOverflowEEE
     2779__ZN7WebCore18ScrollingStateTree23setHasChangedPropertiesEb
    27782780__ZN7WebCore18ScrollingStateTree6commitENS_19LayerRepresentation4TypeE
    27792781__ZN7WebCore18ScrollingStateTree6createEPNS_25AsyncScrollingCoordinatorE
  • trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp

    r166293 r168433  
    154154
    155155    // Now the clone tree has changed properties, and the original tree does not.
    156     treeStateClone->m_hasChangedProperties = true;
     156    treeStateClone->m_hasChangedProperties = m_hasChangedProperties;
    157157    m_hasChangedProperties = false;
    158158
  • trunk/Source/WebKit2/ChangeLog

    r168423 r168433  
     12014-05-06  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add scrolling tree logging to RemoteLayerTree output
     4        https://bugs.webkit.org/show_bug.cgi?id=132640
     5
     6        Reviewed by Beth Dakin.
     7       
     8        Support scrolling tree logging in the RemoteLayerTree log channel
     9        output.
     10       
     11        Encode/decode ScrollingStateTree::hasChangedProperties() so we can use
     12        it to avoid logging. Log all the things.
     13
     14        * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
     15        (WebKit::RemoteScrollingCoordinatorTransaction::encode):
     16        (WebKit::RemoteScrollingCoordinatorTransaction::decode):
     17        (WebKit::RemoteScrollingTreeTextStream::RemoteScrollingTreeTextStream):
     18        (WebKit::RemoteScrollingTreeTextStream::increaseIndent):
     19        (WebKit::RemoteScrollingTreeTextStream::decreaseIndent):
     20        (WebKit::RemoteScrollingTreeTextStream::writeIndent):
     21        (WebKit::dumpProperty):
     22        (WebKit::RemoteScrollingTreeTextStream::operator<<):
     23        (WebKit::RemoteScrollingTreeTextStream::dump):
     24        (WebKit::RemoteScrollingTreeTextStream::recursiveDumpNodes):
     25        (WebKit::RemoteScrollingCoordinatorTransaction::description):
     26        (WebKit::RemoteScrollingCoordinatorTransaction::dump):
     27        * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.h:
     28        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
     29        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
     30
    1312014-05-07  Hyowon Kim  <hw1008.kim@samsung.com>
    232
  • trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp

    r168244 r168433  
    3535#include <WebCore/ScrollingStateScrollingNode.h>
    3636#include <WebCore/ScrollingStateStickyNode.h>
     37#include <WebCore/ScrollingStateTree.h>
     38#include <WebCore/TextStream.h>
     39#include <wtf/text/CString.h>
     40#include <wtf/text/StringBuilder.h>
    3741
    3842#include <wtf/HashMap.h>
     
    278282
    279283    if (m_scrollingStateTree) {
     284        encoder << m_scrollingStateTree->hasChangedProperties();
     285
    280286        if (const ScrollingStateNode* rootNode = m_scrollingStateTree->rootStateNode())
    281287            encodeNodeAndDescendants(encoder, *rootNode);
     
    302308   
    303309    m_scrollingStateTree = ScrollingStateTree::create();
    304    
     310
     311    bool hasChangedProperties;
     312    if (!decoder.decode(hasChangedProperties))
     313        return false;
     314
     315    m_scrollingStateTree->setHasChangedProperties(hasChangedProperties);
     316
    305317    for (int i = 0; i < numNodes; ++i) {
    306318        ScrollingNodeType nodeType;
     
    351363}
    352364
     365#if !defined(NDEBUG) || !LOG_DISABLED
     366
     367class RemoteScrollingTreeTextStream : public TextStream {
     368public:
     369    using TextStream::operator<<;
     370
     371    RemoteScrollingTreeTextStream()
     372        : m_indent(0)
     373    {
     374    }
     375
     376    RemoteScrollingTreeTextStream& operator<<(FloatRect);
     377    RemoteScrollingTreeTextStream& operator<<(ScrollingNodeType);
     378
     379    RemoteScrollingTreeTextStream& operator<<(const FixedPositionViewportConstraints&);
     380    RemoteScrollingTreeTextStream& operator<<(const StickyPositionViewportConstraints&);
     381
     382    void dump(const ScrollingStateTree&, bool changedPropertiesOnly = true);
     383
     384    void dump(const ScrollingStateNode&, bool changedPropertiesOnly = true);
     385    void dump(const ScrollingStateScrollingNode&, bool changedPropertiesOnly = true);
     386    void dump(const ScrollingStateFixedNode&, bool changedPropertiesOnly = true);
     387    void dump(const ScrollingStateStickyNode&, bool changedPropertiesOnly = true);
     388
     389    void increaseIndent() { ++m_indent; }
     390    void decreaseIndent() { --m_indent; ASSERT(m_indent >= 0); }
     391
     392    void writeIndent();
     393
     394private:
     395    void recursiveDumpNodes(const ScrollingStateNode&, bool changedPropertiesOnly);
     396
     397    int m_indent;
     398};
     399
     400void RemoteScrollingTreeTextStream::writeIndent()
     401{
     402    for (int i = 0; i < m_indent; ++i)
     403        *this << "  ";
     404}
     405
     406template <class T>
     407static void dumpProperty(RemoteScrollingTreeTextStream& ts, String name, T value)
     408{
     409    ts << "\n";
     410    ts.increaseIndent();
     411    ts.writeIndent();
     412    ts << "(" << name << " ";
     413    ts << value << ")";
     414    ts.decreaseIndent();
     415}
     416
     417RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(FloatRect rect)
     418{
     419    RemoteScrollingTreeTextStream& ts = *this;
     420    ts << rect.x() << " " << rect.y() << " " << rect.width() << " " << rect.height();
     421    return ts;
     422}
     423
     424RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(ScrollingNodeType nodeType)
     425{
     426    RemoteScrollingTreeTextStream& ts = *this;
     427
     428    switch (nodeType) {
     429    case FrameScrollingNode: ts << "frame-scrolling"; break;
     430    case OverflowScrollingNode: ts << "overflow-scrolling"; break;
     431    case FixedNode: ts << "fixed"; break;
     432    case StickyNode: ts << "sticky"; break;
     433    }
     434
     435    return ts;
     436}
     437
     438RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(const FixedPositionViewportConstraints& constraints)
     439{
     440    RemoteScrollingTreeTextStream& ts = *this;
     441
     442    dumpProperty(ts, "viewport-rect-at-last-layout", constraints.viewportRectAtLastLayout());
     443    dumpProperty(ts, "layer-position-at-last-layout", constraints.layerPositionAtLastLayout());
     444
     445    return ts;
     446}
     447
     448RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(const StickyPositionViewportConstraints& constraints)
     449{
     450    RemoteScrollingTreeTextStream& ts = *this;
     451
     452    dumpProperty(ts, "sticky-position-at-last-layout", constraints.stickyOffsetAtLastLayout());
     453    dumpProperty(ts, "layer-position-at-last-layout", constraints.layerPositionAtLastLayout());
     454
     455    return ts;
     456}
     457
     458void RemoteScrollingTreeTextStream::dump(const ScrollingStateNode& node, bool changedPropertiesOnly)
     459{
     460    RemoteScrollingTreeTextStream& ts = *this;
     461
     462    ts << "(node " << node.scrollingNodeID();
     463
     464    dumpProperty(ts, "type", node.nodeType());
     465
     466    switch (node.nodeType()) {
     467    case FrameScrollingNode:
     468    case OverflowScrollingNode:
     469        dump(toScrollingStateScrollingNode(node), changedPropertiesOnly);
     470        break;
     471    case FixedNode:
     472        dump(toScrollingStateFixedNode(node), changedPropertiesOnly);
     473        break;
     474    case StickyNode:
     475        dump(toScrollingStateStickyNode(node), changedPropertiesOnly);
     476        break;
     477    }
     478}
     479
     480void RemoteScrollingTreeTextStream::dump(const ScrollingStateScrollingNode& node, bool changedPropertiesOnly)
     481{
     482    RemoteScrollingTreeTextStream& ts = *this;
     483
     484    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ViewportSize))
     485        dumpProperty(ts, "viewport-size", node.viewportSize());
     486
     487    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
     488        dumpProperty(ts, "total-contents-size", node.totalContentsSize());
     489
     490    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
     491        dumpProperty(ts, "scroll-position", node.scrollPosition());
     492
     493    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin))
     494        dumpProperty(ts, "scroll-origin", node.scrollOrigin());
     495
     496    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FrameScaleFactor))
     497        dumpProperty(ts, "frame-scale-factor", node.frameScaleFactor());
     498
     499    // FIXME: dump nonFastScrollableRegion
     500    // FIXME: dump wheelEventHandlerCount
     501    // FIXME: dump synchronousScrollingReasons
     502    // FIXME: dump scrollableAreaParameters
     503    // FIXME: dump scrollBehaviorForFixedElements
     504
     505    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
     506        dumpProperty(ts, "requested-scroll-position", node.requestedScrollPosition());
     507        dumpProperty(ts, "requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll());
     508    }
     509
     510    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HeaderHeight))
     511        dumpProperty(ts, "header-height", node.headerHeight());
     512
     513    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FooterHeight))
     514        dumpProperty(ts, "footer-height", node.footerHeight());
     515
     516    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TopContentInset))
     517        dumpProperty(ts, "top-content-inset", node.topContentInset());
     518
     519    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
     520        dumpProperty(ts, "scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer()));
     521
     522    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
     523        dumpProperty(ts, "counter-scrolling-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.counterScrollingLayer()));
     524
     525    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::InsetClipLayer))
     526        dumpProperty(ts, "clip-inset-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.insetClipLayer()));
     527
     528    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HeaderLayer))
     529        dumpProperty(ts, "header-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.headerLayer()));
     530
     531    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FooterLayer))
     532        dumpProperty(ts, "footer-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.footerLayer()));
     533}
     534
     535void RemoteScrollingTreeTextStream::dump(const ScrollingStateFixedNode& node, bool changedPropertiesOnly)
     536{
     537    RemoteScrollingTreeTextStream& ts = *this;
     538
     539    ts << node.viewportConstraints();
     540}
     541
     542void RemoteScrollingTreeTextStream::dump(const ScrollingStateStickyNode& node, bool changedPropertiesOnly)
     543{
     544    RemoteScrollingTreeTextStream& ts = *this;
     545
     546    ts << node.viewportConstraints();
     547}
     548
     549void RemoteScrollingTreeTextStream::recursiveDumpNodes(const ScrollingStateNode& node, bool changedPropertiesOnly)
     550{
     551    RemoteScrollingTreeTextStream& ts = *this;
     552
     553    ts << "\n";
     554    ts.increaseIndent();
     555    ts.writeIndent();
     556    dump(node, changedPropertiesOnly);
     557
     558    if (node.children()) {
     559        ts << "\n";
     560        ts.increaseIndent();
     561        ts.writeIndent();
     562        ts << "(children";
     563        ts.increaseIndent();
     564
     565        for (auto& childNode : *node.children())
     566            recursiveDumpNodes(*childNode, changedPropertiesOnly);
     567
     568        ts << ")";
     569        ts.decreaseIndent();
     570        ts.decreaseIndent();
     571    }
     572
     573    ts << ")";
     574    ts.decreaseIndent();
     575}
     576
     577void RemoteScrollingTreeTextStream::dump(const ScrollingStateTree& stateTree, bool changedPropertiesOnly)
     578{
     579    RemoteScrollingTreeTextStream& ts = *this;
     580
     581    dumpProperty(ts, "has changed properties", stateTree.hasChangedProperties());
     582    dumpProperty(ts, "has new root node", stateTree.hasNewRootStateNode());
     583
     584    if (stateTree.rootStateNode())
     585        recursiveDumpNodes(*stateTree.rootStateNode(), changedPropertiesOnly);
     586
     587    if (!stateTree.removedNodes().isEmpty())
     588        dumpProperty<Vector<ScrollingNodeID>>(ts, "removed-nodes", stateTree.removedNodes());
     589}
     590
     591WTF::CString RemoteScrollingCoordinatorTransaction::description() const
     592{
     593    RemoteScrollingTreeTextStream ts;
     594
     595    ts << "(\n";
     596    ts.increaseIndent();
     597    ts.writeIndent();
     598    ts << "(scrolling state tree";
     599
     600    if (m_scrollingStateTree) {
     601        if (!m_scrollingStateTree->hasChangedProperties())
     602            ts << " - no changes";
     603        else
     604            ts.dump(*m_scrollingStateTree.get());
     605    } else
     606        ts << " - none";
     607
     608    ts << ")\n";
     609    ts.decreaseIndent();
     610
     611    return ts.release().utf8();
     612}
     613
     614void RemoteScrollingCoordinatorTransaction::dump() const
     615{
     616    fprintf(stderr, "%s", description().data());
     617}
     618#endif
     619
    353620} // namespace WebKit
    354621
  • trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.h

    r161533 r168433  
    4949    static bool decode(IPC::ArgumentDecoder&, RemoteScrollingCoordinatorTransaction&);
    5050
     51#if !defined(NDEBUG) || !LOG_DISABLED
     52    WTF::CString description() const;
     53    void dump() const;
     54#endif
     55
    5156private:
    5257#if ENABLE(ASYNC_SCROLLING)
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm

    r168301 r168433  
    3131#import "DrawingAreaMessages.h"
    3232#import "RemoteScrollingCoordinatorProxy.h"
     33#import "RemoteScrollingCoordinatorTransaction.h"
    3334#import "WebPageProxy.h"
    3435#import "WebProcessProxy.h"
     
    119120{
    120121    LOG(RemoteLayerTree, "%s", layerTreeTransaction.description().data());
     122    LOG(RemoteLayerTree, "%s", scrollingTreeTransaction.description().data());
    121123
    122124    if (m_remoteLayerTreeHost.updateLayerTree(layerTreeTransaction))
Note: See TracChangeset for help on using the changeset viewer.