Title: [208369] branches/safari-602-branch/Source

Diff

Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (208368 => 208369)


--- branches/safari-602-branch/Source/WebCore/ChangeLog	2016-11-04 04:47:58 UTC (rev 208368)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog	2016-11-04 05:05:32 UTC (rev 208369)
@@ -1,5 +1,29 @@
 2016-11-03  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r208328. rdar://problem/29084886
+
+    2016-11-03  Dan Bernstein  <m...@apple.com>
+
+            REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
+            https://bugs.webkit.org/show_bug.cgi?id=164340
+            <rdar://problem/29074344>
+
+            Reviewed by Tim Horton.
+
+            To give WebKit a chance to deliver the painting milestones to its client after the commit,
+            we must tell it about them before or during the commit. To that end, we should not defer
+            the call to firePaintRelatedMilestonesIfNeeded until after the commit.
+
+            * rendering/RenderLayerCompositor.cpp:
+            (WebCore::RenderLayerCompositor::RenderLayerCompositor): Removed
+              m_paintRelatedMilestonesTimer initializer.
+            (WebCore::RenderLayerCompositor::didPaintBacking): Call
+              FrameView::firePaintRelatedMilestonesIfNeeded directly from here.
+            (WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired): Deleted.
+            * rendering/RenderLayerCompositor.h:
+
+2016-11-03  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r208319. rdar://problem/29084077
 
     2016-11-02  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-602-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (208368 => 208369)


--- branches/safari-602-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2016-11-04 04:47:58 UTC (rev 208368)
+++ branches/safari-602-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2016-11-04 05:05:32 UTC (rev 208369)
@@ -274,7 +274,6 @@
 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView)
     : m_renderView(renderView)
     , m_updateCompositingLayersTimer(*this, &RenderLayerCompositor::updateCompositingLayersTimerFired)
-    , m_paintRelatedMilestonesTimer(*this, &RenderLayerCompositor::paintRelatedMilestonesTimerFired)
     , m_layerFlushTimer(*this, &RenderLayerCompositor::layerFlushTimerFired)
 {
 }
@@ -569,8 +568,8 @@
 {
     FrameView& frameView = m_renderView.frameView();
     frameView.setLastPaintTime(monotonicallyIncreasingTime());
-    if (frameView.milestonesPendingPaint() && !m_paintRelatedMilestonesTimer.isActive())
-        m_paintRelatedMilestonesTimer.startOneShot(0);
+    if (frameView.milestonesPendingPaint())
+        frameView.firePaintRelatedMilestonesIfNeeded();
 }
 
 void RenderLayerCompositor::didChangeVisibleRect()
@@ -4203,20 +4202,6 @@
     scheduleLayerFlushNow();
 }
 
-void RenderLayerCompositor::paintRelatedMilestonesTimerFired()
-{
-    Frame& frame = m_renderView.frameView().frame();
-    Page* page = frame.page();
-    if (!page)
-        return;
-
-    // If the layer tree is frozen, we'll paint when it's unfrozen and schedule the timer again.
-    if (page->chrome().client().layerTreeStateIsFrozen())
-        return;
-
-    m_renderView.frameView().firePaintRelatedMilestonesIfNeeded();
-}
-
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
 RefPtr<DisplayRefreshMonitor> RenderLayerCompositor::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
 {

Modified: branches/safari-602-branch/Source/WebCore/rendering/RenderLayerCompositor.h (208368 => 208369)


--- branches/safari-602-branch/Source/WebCore/rendering/RenderLayerCompositor.h	2016-11-04 04:47:58 UTC (rev 208368)
+++ branches/safari-602-branch/Source/WebCore/rendering/RenderLayerCompositor.h	2016-11-04 05:05:32 UTC (rev 208369)
@@ -475,8 +475,6 @@
     void startLayerFlushTimerIfNeeded();
     void layerFlushTimerFired();
 
-    void paintRelatedMilestonesTimerFired();
-
 #if !LOG_DISABLED
     const char* logReasonsForCompositing(const RenderLayer&);
     void logLayerInfo(const RenderLayer&, int depth);
@@ -548,7 +546,6 @@
 
     std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running.
 
-    Timer m_paintRelatedMilestonesTimer;
     Timer m_layerFlushTimer;
 
     bool m_layerFlushThrottlingEnabled { false };

Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (208368 => 208369)


--- branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-11-04 04:47:58 UTC (rev 208368)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-11-04 05:05:32 UTC (rev 208369)
@@ -1,5 +1,26 @@
 2016-11-03  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r208328. rdar://problem/29084886
+
+    2016-11-03  Dan Bernstein  <m...@apple.com>
+
+            REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
+            https://bugs.webkit.org/show_bug.cgi?id=164340
+            <rdar://problem/29074344>
+
+            Reviewed by Tim Horton.
+
+            * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: Declared new helper function.
+            * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+            (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Helper
+              function that sends the message to the UI process and resets
+              m_pendingNewlyReachedLayoutMilestones.
+            (WebKit::TiledCoreAnimationDrawingArea::flushLayers): Wait until after the commit to get the
+              pending milestones and send them to the UI process. This way we don’t miss milestones that
+              fire during the commit.
+
+2016-11-03  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r208340. rdar://problem/29092397
 
     2016-11-03  Dan Bernstein  <m...@apple.com>

Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (208368 => 208369)


--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2016-11-04 04:47:58 UTC (rev 208368)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2016-11-04 05:05:32 UTC (rev 208369)
@@ -122,6 +122,8 @@
     void updateScrolledExposedRect();
     void scaleViewToFitDocumentIfNeeded();
 
+    void sendPendingNewlyReachedLayoutMilestones();
+
     bool m_layerTreeStateIsFrozen;
     WebCore::LayerFlushScheduler m_layerFlushScheduler;
 

Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (208368 => 208369)


--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2016-11-04 04:47:58 UTC (rev 208368)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2016-11-04 05:05:32 UTC (rev 208369)
@@ -394,6 +394,15 @@
 #endif
 }
 
+void TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones()
+{
+    if (!m_pendingNewlyReachedLayoutMilestones)
+        return;
+
+    m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedLayoutMilestones));
+    m_pendingNewlyReachedLayoutMilestones = 0;
+}
+
 bool TiledCoreAnimationDrawingArea::flushLayers()
 {
     ASSERT(!m_layerTreeStateIsFrozen);
@@ -418,14 +427,21 @@
         if (m_viewOverlayRootLayer)
             m_viewOverlayRootLayer->flushCompositingState(visibleRect, m_webPage.mainFrameView()->viewportIsStable());
 
+        RefPtr<WebPage> retainedPage = &m_webPage;
 #if TARGET_OS_IPHONE || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
-        RefPtr<WebPage> retainedPage = &m_webPage;
         [CATransaction addCommitHandler:[retainedPage] {
             if (Page* corePage = retainedPage->corePage()) {
                 if (Frame* coreFrame = retainedPage->mainFrame())
                     corePage->inspectorController().didComposite(*coreFrame);
             }
+            if (auto drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(retainedPage->drawingArea()))
+                drawingArea->sendPendingNewlyReachedLayoutMilestones();
         } forPhase:kCATransactionPhasePostCommit];
+#else
+        dispatch_async(dispatch_get_main_queue(), [retainedPage] {
+            if (auto drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(retainedPage->drawingArea()))
+                drawingArea->sendPendingNewlyReachedLayoutMilestones();
+        });
 #endif
 
         bool returnValue = m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
@@ -439,10 +455,6 @@
         if (m_transientZoomScale != 1)
             applyTransientZoomToLayers(m_transientZoomScale, m_transientZoomOrigin);
 
-        if (m_pendingNewlyReachedLayoutMilestones)
-            m_webPage.send(Messages::WebPageProxy::DidReachLayoutMilestone(m_pendingNewlyReachedLayoutMilestones));
-        m_pendingNewlyReachedLayoutMilestones = 0;
-
         return returnValue;
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to