It is still possible to fire paint-related LayoutMilestones before CA has committed the changes. To ensure we wait for the commit, we should wait until the end of the runloop with a zero-delay timer.
Created attachment 200968 [details]
Comment on attachment 200968 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=200968&action=review
> + (WebCore::RenderLayerCompositor::firePaintRelatedMilestonesTimerFired):
What a bizarre name, with fire in it twice :)
Created attachment 200971 [details]
Tim has a good point. Here's a patch with a better name.
Thank you, Simon! http://trac.webkit.org/changeset/149691
Comment on attachment 200971 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=200971&action=review
> + if (!m_paintRelatedMilestonesTimer.isActive())
> + m_paintRelatedMilestonesTimer.startOneShot(0);
This made it so that _every_ layer flush we start a timer, which most of the time does nothing :(
Filed bug 116908.