Changeset 244291 in webkit


Ignore:
Timestamp:
Apr 15, 2019 2:34:10 PM (5 years ago)
Author:
Alan Bujtas
Message:

DrawingArea should only capture painting related milestones
https://bugs.webkit.org/show_bug.cgi?id=196926
<rdar://problem/48003845>

Reviewed by Tim Horton.

While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.

  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:

(WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
(WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
(WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
(WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.

  • Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::encode const):
(WebKit::RemoteLayerTreeTransaction::decode):

  • UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

  • WebProcess/WebPage/DrawingArea.h:

(WebKit::DrawingArea::addMilestonesToDispatch):
(WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.

  • WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:

(WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):

  • WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:

(WebKit::RemoteLayerTreeDrawingArea::flushLayers):
(WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::dispatchDidReachLayoutMilestone):

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:

(WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
(WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.

Location:
trunk/Source/WebKit
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244288 r244291  
     12019-04-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        DrawingArea should only capture painting related milestones
     4        https://bugs.webkit.org/show_bug.cgi?id=196926
     5        <rdar://problem/48003845>
     6
     7        Reviewed by Tim Horton.
     8
     9        While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
     10        These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
     11        However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
     12
     13        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
     14        (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
     15        (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
     16        (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
     17        (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
     18        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
     19        (WebKit::RemoteLayerTreeTransaction::encode const):
     20        (WebKit::RemoteLayerTreeTransaction::decode):
     21        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
     22        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
     23        * WebProcess/WebPage/DrawingArea.h:
     24        (WebKit::DrawingArea::addMilestonesToDispatch):
     25        (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
     26        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
     27        (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
     28        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
     29        (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
     30        (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
     31        * WebProcess/WebPage/WebPage.cpp:
     32        (WebKit::WebPage::dispatchDidReachLayoutMilestone):
     33        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
     34        (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
     35        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     36        (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
     37        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
     38        (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
     39        (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
     40
    1412019-04-15  John Wilander  <wilander@apple.com>
    242
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h

    r243962 r244291  
    272272    void setCallbackIDs(Vector<TransactionCallbackID>&& callbackIDs) { m_callbackIDs = WTFMove(callbackIDs); }
    273273
    274     OptionSet<WebCore::LayoutMilestone> newlyReachedLayoutMilestones() const { return m_newlyReachedLayoutMilestones; }
    275     void setNewlyReachedLayoutMilestones(OptionSet<WebCore::LayoutMilestone> milestones) { m_newlyReachedLayoutMilestones = milestones; }
     274    OptionSet<WebCore::LayoutMilestone> newlyReachedPaintingMilestones() const { return m_newlyReachedPaintingMilestones; }
     275    void setNewlyReachedPaintingMilestones(OptionSet<WebCore::LayoutMilestone> milestones) { m_newlyReachedPaintingMilestones = milestones; }
    276276
    277277    bool hasEditorState() const { return !!m_editorState; }
     
    309309    uint64_t m_transactionID { 0 };
    310310    ActivityStateChangeID m_activityStateChangeID { ActivityStateChangeAsynchronous };
    311     OptionSet<WebCore::LayoutMilestone> m_newlyReachedLayoutMilestones;
     311    OptionSet<WebCore::LayoutMilestone> m_newlyReachedPaintingMilestones;
    312312    bool m_scaleWasSetByUIProcess { false };
    313313    bool m_allowsUserScaling { false };
  • trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm

    r243962 r244291  
    563563    encoder << m_activityStateChangeID;
    564564
    565     encoder << m_newlyReachedLayoutMilestones;
     565    encoder << m_newlyReachedPaintingMilestones;
    566566
    567567    encoder << m_scaleWasSetByUIProcess;
     
    674674        return false;
    675675
    676     if (!decoder.decode(result.m_newlyReachedLayoutMilestones))
     676    if (!decoder.decode(result.m_newlyReachedPaintingMilestones))
    677677        return false;
    678678
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm

    r243847 r244291  
    256256#endif
    257257
    258     if (auto milestones = layerTreeTransaction.newlyReachedLayoutMilestones())
     258    if (auto milestones = layerTreeTransaction.newlyReachedPaintingMilestones())
    259259        m_webPageProxy.didReachLayoutMilestone(milestones);
    260260
  • trunk/Source/WebKit/WebProcess/WebPage/DrawingArea.h

    r242346 r244291  
    133133    virtual void setShouldScaleViewToFitDocument(bool) { }
    134134
    135     virtual bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) { return false; }
     135    virtual bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone>) { return false; }
    136136
    137137#if PLATFORM(COCOA)
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h

    r244198 r244291  
    110110    bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) override;
    111111
    112     bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) override;
     112    bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone>) override;
    113113
    114114    void updateScrolledExposedRect();
     
    174174    ActivityStateChangeID m_activityStateChangeID { ActivityStateChangeAsynchronous };
    175175
    176     OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedLayoutMilestones;
     176    OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedPaintingMilestones;
    177177
    178178    RefPtr<WebCore::GraphicsLayer> m_contentLayer;
     
    180180};
    181181
     182inline bool RemoteLayerTreeDrawingArea::addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones)
     183{
     184    m_pendingNewlyReachedPaintingMilestones.add(paintMilestones);
     185    return true;
     186}
     187
    182188} // namespace WebKit
    183189
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm

    r244198 r244291  
    391391    m_webPage.willCommitLayerTree(layerTransaction);
    392392
    393     layerTransaction.setNewlyReachedLayoutMilestones(m_pendingNewlyReachedLayoutMilestones);
    394     m_pendingNewlyReachedLayoutMilestones = { };
     393    layerTransaction.setNewlyReachedPaintingMilestones(m_pendingNewlyReachedPaintingMilestones);
     394    m_pendingNewlyReachedPaintingMilestones = { };
    395395
    396396    layerTransaction.setActivityStateChangeID(m_activityStateChangeID);
     
    533533}
    534534
    535 bool RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone> layoutMilestones)
    536 {
    537     m_pendingNewlyReachedLayoutMilestones.add(layoutMilestones);
    538     return true;
    539 }
    540 
    541535void RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea(DrawingArea& oldDrawingArea)
    542536{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r244202 r244291  
    62266226
    62276227    // The drawing area might want to defer dispatch of didLayout to the UI process.
    6228     if (m_drawingArea && m_drawingArea->dispatchDidReachLayoutMilestone(milestones))
    6229         return;
     6228    if (m_drawingArea) {
     6229        static auto paintMilestones = OptionSet<WebCore::LayoutMilestone> { DidHitRelevantRepaintedObjectsAreaThreshold, DidFirstFlushForHeaderLayer, DidFirstPaintAfterSuppressedIncrementalRendering, DidRenderSignificantAmountOfText, DidFirstMeaningfulPaint };   
     6230        auto drawingAreaRelatedMilestones = milestones & paintMilestones;
     6231        if (drawingAreaRelatedMilestones && m_drawingArea->addMilestonesToDispatch(drawingAreaRelatedMilestones))
     6232            milestones.remove(drawingAreaRelatedMilestones);
     6233    }
    62306234
    62316235    send(Messages::WebPageProxy::DidReachLayoutMilestone(milestones));
  • trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r243381 r244291  
    8787    void attachViewOverlayGraphicsLayer(WebCore::GraphicsLayer*) override;
    8888
    89     bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) override;
     89    bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones) override;
    9090
    9191    enum class FlushType { Normal, TransientZoom };
     
    126126    void scaleViewToFitDocumentIfNeeded();
    127127
    128     void sendPendingNewlyReachedLayoutMilestones();
     128    void sendPendingNewlyReachedPaintingMilestones();
    129129
    130130    void layerFlushRunLoopCallback();
     
    164164    RefPtr<WebCore::GraphicsLayer> m_viewOverlayRootLayer;
    165165
    166     OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedLayoutMilestones;
     166    OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedPaintingMilestones;
    167167    Vector<CallbackID> m_pendingCallbackIDs;
    168168
     
    179179};
    180180
     181inline bool TiledCoreAnimationDrawingArea::addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones)
     182{
     183    m_pendingNewlyReachedPaintingMilestones.add(paintMilestones);
     184    return true;
     185}
     186
    181187} // namespace WebKit
    182188
  • trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r244182 r244291  
    437437}
    438438
    439 void TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones()
    440 {
    441     if (!m_pendingNewlyReachedLayoutMilestones)
    442         return;
    443 
    444     m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedLayoutMilestones));
    445     m_pendingNewlyReachedLayoutMilestones = { };
     439void TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones()
     440{
     441    if (!m_pendingNewlyReachedPaintingMilestones)
     442        return;
     443
     444    m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedPaintingMilestones));
     445    m_pendingNewlyReachedPaintingMilestones = { };
    446446}
    447447
     
    485485            }
    486486            if (auto drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(retainedPage->drawingArea()))
    487                 drawingArea->sendPendingNewlyReachedLayoutMilestones();
     487                drawingArea->sendPendingNewlyReachedPaintingMilestones();
    488488        } forPhase:kCATransactionPhasePostCommit];
    489489
     
    932932}
    933933
    934 bool TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone> layoutMilestones)
    935 {
    936     m_pendingNewlyReachedLayoutMilestones.add(layoutMilestones);
    937     return true;
    938 }
    939 
    940934void TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback()
    941935{
Note: See TracChangeset for help on using the changeset viewer.