Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/211192@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Apr 15, 2019
1 parent bdd5f68 commit 67f73f9adf12f9ab2a62918083e54d94cd5fef87
Showing 10 changed files with 77 additions and 33 deletions.
@@ -1,3 +1,43 @@
2019-04-15 Zalan Bujtas <zalan@apple.com>

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.

2019-04-15 John Wilander <wilander@apple.com>

Send delayed Ad Click Attribution conversion requests to the click source
@@ -271,8 +271,8 @@ class RemoteLayerTreeTransaction {
const Vector<TransactionCallbackID>& callbackIDs() const { return m_callbackIDs; }
void setCallbackIDs(Vector<TransactionCallbackID>&& callbackIDs) { m_callbackIDs = WTFMove(callbackIDs); }

OptionSet<WebCore::LayoutMilestone> newlyReachedLayoutMilestones() const { return m_newlyReachedLayoutMilestones; }
void setNewlyReachedLayoutMilestones(OptionSet<WebCore::LayoutMilestone> milestones) { m_newlyReachedLayoutMilestones = milestones; }
OptionSet<WebCore::LayoutMilestone> newlyReachedPaintingMilestones() const { return m_newlyReachedPaintingMilestones; }
void setNewlyReachedPaintingMilestones(OptionSet<WebCore::LayoutMilestone> milestones) { m_newlyReachedPaintingMilestones = milestones; }

bool hasEditorState() const { return !!m_editorState; }
const EditorState& editorState() const { return m_editorState.value(); }
@@ -308,7 +308,7 @@ class RemoteLayerTreeTransaction {
uint64_t m_renderTreeSize { 0 };
uint64_t m_transactionID { 0 };
ActivityStateChangeID m_activityStateChangeID { ActivityStateChangeAsynchronous };
OptionSet<WebCore::LayoutMilestone> m_newlyReachedLayoutMilestones;
OptionSet<WebCore::LayoutMilestone> m_newlyReachedPaintingMilestones;
bool m_scaleWasSetByUIProcess { false };
bool m_allowsUserScaling { false };
bool m_avoidsUnsafeArea { true };
@@ -562,7 +562,7 @@
encoder << m_transactionID;
encoder << m_activityStateChangeID;

encoder << m_newlyReachedLayoutMilestones;
encoder << m_newlyReachedPaintingMilestones;

encoder << m_scaleWasSetByUIProcess;
encoder << m_allowsUserScaling;
@@ -673,7 +673,7 @@
if (!decoder.decode(result.m_activityStateChangeID))
return false;

if (!decoder.decode(result.m_newlyReachedLayoutMilestones))
if (!decoder.decode(result.m_newlyReachedPaintingMilestones))
return false;

if (!decoder.decode(result.m_scaleWasSetByUIProcess))
@@ -255,7 +255,7 @@ - (void)pause
didRefreshDisplay();
#endif

if (auto milestones = layerTreeTransaction.newlyReachedLayoutMilestones())
if (auto milestones = layerTreeTransaction.newlyReachedPaintingMilestones())
m_webPageProxy.didReachLayoutMilestone(milestones);

for (auto& callbackID : layerTreeTransaction.callbackIDs()) {
@@ -132,7 +132,7 @@ class DrawingArea : public IPC::MessageReceiver {

virtual void setShouldScaleViewToFitDocument(bool) { }

virtual bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) { return false; }
virtual bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone>) { return false; }

#if PLATFORM(COCOA)
// Used by TiledCoreAnimationDrawingArea.
@@ -109,7 +109,7 @@ class RemoteLayerTreeDrawingArea : public DrawingArea, public CanMakeWeakPtr<Rem

bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) override;

bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) override;
bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone>) override;

void updateScrolledExposedRect();
void updateRootLayers();
@@ -173,12 +173,18 @@ class RemoteLayerTreeDrawingArea : public DrawingArea, public CanMakeWeakPtr<Rem
Vector<RemoteLayerTreeTransaction::TransactionCallbackID> m_pendingCallbackIDs;
ActivityStateChangeID m_activityStateChangeID { ActivityStateChangeAsynchronous };

OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedLayoutMilestones;
OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedPaintingMilestones;

RefPtr<WebCore::GraphicsLayer> m_contentLayer;
RefPtr<WebCore::GraphicsLayer> m_viewOverlayRootLayer;
};

inline bool RemoteLayerTreeDrawingArea::addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones)
{
m_pendingNewlyReachedPaintingMilestones.add(paintMilestones);
return true;
}

} // namespace WebKit

SPECIALIZE_TYPE_TRAITS_DRAWING_AREA(RemoteLayerTreeDrawingArea, DrawingAreaTypeRemoteLayerTree)
@@ -390,8 +390,8 @@
backingStoreCollection.willCommitLayerTree(layerTransaction);
m_webPage.willCommitLayerTree(layerTransaction);

layerTransaction.setNewlyReachedLayoutMilestones(m_pendingNewlyReachedLayoutMilestones);
m_pendingNewlyReachedLayoutMilestones = { };
layerTransaction.setNewlyReachedPaintingMilestones(m_pendingNewlyReachedPaintingMilestones);
m_pendingNewlyReachedPaintingMilestones = { };

layerTransaction.setActivityStateChangeID(m_activityStateChangeID);
m_activityStateChangeID = ActivityStateChangeAsynchronous;
@@ -532,12 +532,6 @@
scheduleCompositingLayerFlush();
}

bool RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone> layoutMilestones)
{
m_pendingNewlyReachedLayoutMilestones.add(layoutMilestones);
return true;
}

void RemoteLayerTreeDrawingArea::adoptLayersFromDrawingArea(DrawingArea& oldDrawingArea)
{
RELEASE_ASSERT(oldDrawingArea.type() == type());
@@ -6225,8 +6225,12 @@ void WebPage::dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone
ASSERT(!userData);

// The drawing area might want to defer dispatch of didLayout to the UI process.
if (m_drawingArea && m_drawingArea->dispatchDidReachLayoutMilestone(milestones))
return;
if (m_drawingArea) {
static auto paintMilestones = OptionSet<WebCore::LayoutMilestone> { DidHitRelevantRepaintedObjectsAreaThreshold, DidFirstFlushForHeaderLayer, DidFirstPaintAfterSuppressedIncrementalRendering, DidRenderSignificantAmountOfText, DidFirstMeaningfulPaint };
auto drawingAreaRelatedMilestones = milestones & paintMilestones;
if (drawingAreaRelatedMilestones && m_drawingArea->addMilestonesToDispatch(drawingAreaRelatedMilestones))
milestones.remove(drawingAreaRelatedMilestones);
}

send(Messages::WebPageProxy::DidReachLayoutMilestone(milestones));
}
@@ -86,7 +86,7 @@ class TiledCoreAnimationDrawingArea : public DrawingArea, public CanMakeWeakPtr<

void attachViewOverlayGraphicsLayer(WebCore::GraphicsLayer*) override;

bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) override;
bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones) override;

enum class FlushType { Normal, TransientZoom };
void flushLayers(FlushType = FlushType::Normal);
@@ -125,7 +125,7 @@ class TiledCoreAnimationDrawingArea : public DrawingArea, public CanMakeWeakPtr<
void updateScrolledExposedRect();
void scaleViewToFitDocumentIfNeeded();

void sendPendingNewlyReachedLayoutMilestones();
void sendPendingNewlyReachedPaintingMilestones();

void layerFlushRunLoopCallback();
void invalidateLayerFlushRunLoopObserver();
@@ -163,7 +163,7 @@ class TiledCoreAnimationDrawingArea : public DrawingArea, public CanMakeWeakPtr<

RefPtr<WebCore::GraphicsLayer> m_viewOverlayRootLayer;

OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedLayoutMilestones;
OptionSet<WebCore::LayoutMilestone> m_pendingNewlyReachedPaintingMilestones;
Vector<CallbackID> m_pendingCallbackIDs;

std::unique_ptr<WebCore::RunLoopObserver> m_layerFlushRunLoopObserver;
@@ -178,6 +178,12 @@ class TiledCoreAnimationDrawingArea : public DrawingArea, public CanMakeWeakPtr<
bool m_needsSendEnterAcceleratedCompositingMode { true };
};

inline bool TiledCoreAnimationDrawingArea::addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones)
{
m_pendingNewlyReachedPaintingMilestones.add(paintMilestones);
return true;
}

} // namespace WebKit

SPECIALIZE_TYPE_TRAITS_DRAWING_AREA(TiledCoreAnimationDrawingArea, DrawingAreaTypeTiledCoreAnimation)
@@ -436,13 +436,13 @@ + (void)synchronize;
#endif
}

void TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones()
void TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones()
{
if (!m_pendingNewlyReachedLayoutMilestones)
if (!m_pendingNewlyReachedPaintingMilestones)
return;

m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedLayoutMilestones));
m_pendingNewlyReachedLayoutMilestones = { };
m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedPaintingMilestones));
m_pendingNewlyReachedPaintingMilestones = { };
}

void TiledCoreAnimationDrawingArea::addTransactionCallbackID(CallbackID callbackID)
@@ -484,7 +484,7 @@ + (void)synchronize;
corePage->inspectorController().didComposite(*coreFrame);
}
if (auto drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(retainedPage->drawingArea()))
drawingArea->sendPendingNewlyReachedLayoutMilestones();
drawingArea->sendPendingNewlyReachedPaintingMilestones();
} forPhase:kCATransactionPhasePostCommit];

bool didFlushAllFrames = m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
@@ -931,12 +931,6 @@ static FloatRect shadowLayerBoundsForFrame(FrameView& frameView, float transient
m_layerHostingContext->setFencePort(fencePort.sendRight());
}

bool TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone> layoutMilestones)
{
m_pendingNewlyReachedLayoutMilestones.add(layoutMilestones);
return true;
}

void TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback()
{
flushLayers();

0 comments on commit 67f73f9

Please sign in to comment.