Title: [266412] trunk/Source/WebKit
Revision
266412
Author
[email protected]
Date
2020-09-01 14:49:13 -0700 (Tue, 01 Sep 2020)

Log Message

Unreviewed, reverting r266384.

Revision is causing 5 API faliures/timeouts and build failures
on macOS

Reverted changeset:

"Webpages flash when switching between windows"
https://bugs.webkit.org/show_bug.cgi?id=216012
https://trac.webkit.org/changeset/266384

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (266411 => 266412)


--- trunk/Source/WebKit/ChangeLog	2020-09-01 21:25:43 UTC (rev 266411)
+++ trunk/Source/WebKit/ChangeLog	2020-09-01 21:49:13 UTC (rev 266412)
@@ -1,3 +1,16 @@
+2020-09-01  Hector Lopez  <[email protected]>
+
+        Unreviewed, reverting r266384.
+
+        Revision is causing 5 API faliures/timeouts and build failures
+        on macOS
+
+        Reverted changeset:
+
+        "Webpages flash when switching between windows"
+        https://bugs.webkit.org/show_bug.cgi?id=216012
+        https://trac.webkit.org/changeset/266384
+
 2020-09-01  Per Arne Vollan  <[email protected]>
 
         [iOS] AGX compiler service sandbox violation

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (266411 => 266412)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2020-09-01 21:25:43 UTC (rev 266411)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2020-09-01 21:49:13 UTC (rev 266412)
@@ -49,7 +49,6 @@
 #import <WebCore/TextAlternativeWithRange.h>
 #import <WebCore/ValidationBubble.h>
 #import <pal/spi/cocoa/NEFilterSourceSPI.h>
-#import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/SoftLinking.h>
 #import <wtf/cf/TypeCastsCF.h>
@@ -488,21 +487,6 @@
 
 #endif // HAVE(QUICKLOOK_THUMBNAILING)
 
-void WebPageProxy::scheduleActivityStateUpdate()
-{
-    if (m_hasScheduledActivityStateUpdate)
-        return;
-    m_hasScheduledActivityStateUpdate = true;
-
-    [CATransaction addCommitHandler:[weakThis = makeWeakPtr(*this)] {
-        auto strongThis = makeRefPtr(weakThis.get());
-        if (!strongThis)
-            return;
-        strongThis->m_hasScheduledActivityStateUpdate = false;
-        strongThis->dispatchActivityStateChange();
-    } forPhase:kCATransactionPhasePostCommit];
-}
-
 } // namespace WebKit
 
 #undef MESSAGE_CHECK_COMPLETION

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (266411 => 266412)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-09-01 21:25:43 UTC (rev 266411)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-09-01 21:49:13 UTC (rev 266412)
@@ -532,6 +532,12 @@
         disableServiceWorkerEntitlementInNetworkProcess();
 #endif
 
+#if PLATFORM(COCOA)
+    m_activityStateChangeDispatcher = makeUnique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::ActivityStateChange), [this] {
+        this->dispatchActivityStateChange();
+    });
+#endif
+
 #if ENABLE(REMOTE_INSPECTOR)
     m_inspectorDebuggable->setRemoteDebuggingAllowed(true);
     m_inspectorDebuggable->init();
@@ -1850,7 +1856,7 @@
 
     if (!m_suppressVisibilityUpdates) {
 #if PLATFORM(COCOA)
-        scheduleActivityStateUpdate();
+        m_activityStateChangeDispatcher->schedule();
 #else
         dispatchActivityStateChange();
 #endif
@@ -1902,7 +1908,7 @@
         dispatchActivityStateChange();
         return;
     }
-    scheduleActivityStateUpdate();
+    m_activityStateChangeDispatcher->schedule();
 #else
     UNUSED_PARAM(dispatchMode);
     dispatchActivityStateChange();
@@ -1930,6 +1936,10 @@
 
 void WebPageProxy::dispatchActivityStateChange()
 {
+#if PLATFORM(COCOA)
+    m_activityStateChangeDispatcher->invalidate();
+#endif
+
     if (!hasRunningProcess())
         return;
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (266411 => 266412)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-09-01 21:25:43 UTC (rev 266411)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-09-01 21:49:13 UTC (rev 266412)
@@ -898,8 +898,6 @@
     void setScrollPerformanceDataCollectionEnabled(bool);
     bool scrollPerformanceDataCollectionEnabled() const { return m_scrollPerformanceDataCollectionEnabled; }
     RemoteLayerTreeScrollingPerformanceData* scrollingPerformanceData() { return m_scrollingPerformanceData.get(); }
-
-    void scheduleActivityStateUpdate();
 #endif // PLATFORM(COCOA)
 
     void changeFontAttributes(WebCore::FontAttributeChanges&&);
@@ -2717,11 +2715,10 @@
 #if PLATFORM(COCOA)
     using TemporaryPDFFileMap = HashMap<String, String>;
     TemporaryPDFFileMap m_temporaryPDFFiles;
+    std::unique_ptr<WebCore::RunLoopObserver> m_activityStateChangeDispatcher;
 
     std::unique_ptr<RemoteLayerTreeScrollingPerformanceData> m_scrollingPerformanceData;
     bool m_scrollPerformanceDataCollectionEnabled { false };
-
-    bool m_hasScheduledActivityStateUpdate { false };
 #endif
     UserObservablePageCounter::Token m_pageIsUserObservableCount;
     ProcessSuppressionDisabledToken m_preventProcessSuppressionCount;

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (266411 => 266412)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2020-09-01 21:25:43 UTC (rev 266411)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2020-09-01 21:49:13 UTC (rev 266412)
@@ -108,7 +108,6 @@
 
     void sendEnterAcceleratedCompositingModeIfNeeded() override;
     void sendDidFirstLayerFlushIfNeeded();
-    void handleActivityStateChangeCallbacksIfNeeded();
 
     void adjustTransientZoom(double scale, WebCore::FloatPoint origin) override;
     void commitTransientZoom(double scale, WebCore::FloatPoint origin) override;
@@ -152,6 +151,7 @@
     double m_transientZoomScale { 1 };
     WebCore::FloatPoint m_transientZoomOrigin;
 
+    RunLoop::Timer<TiledCoreAnimationDrawingArea> m_sendDidUpdateActivityStateTimer;
     Vector<CallbackID> m_nextActivityStateChangeCallbackIDs;
     ActivityStateChangeID m_activityStateChangeID { ActivityStateChangeAsynchronous };
 
@@ -169,7 +169,6 @@
     bool m_isScalingViewToFitDocument { false };
     bool m_needsSendEnterAcceleratedCompositingMode { true };
     bool m_needsSendDidFirstLayerFlush { true };
-    bool m_shouldHandleActivityStateChangeCallbacks { false };
 };
 
 inline bool TiledCoreAnimationDrawingArea::addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone> paintMilestones)

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (266411 => 266412)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2020-09-01 21:25:43 UTC (rev 266411)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2020-09-01 21:49:13 UTC (rev 266412)
@@ -73,6 +73,7 @@
 
 TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage& webPage, const WebPageCreationParameters& parameters)
     : DrawingArea(DrawingAreaTypeTiledCoreAnimation, parameters.drawingAreaIdentifier, webPage)
+    , m_sendDidUpdateActivityStateTimer(RunLoop::main(), this, &TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired)
     , m_isPaintingSuspended(!(parameters.activityState & ActivityState::IsVisible))
 {
     m_webPage.corePage()->settings().setForceCompositingMode(true);
@@ -132,36 +133,6 @@
     send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(0, layerTreeContext));
 }
 
-void TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded()
-{
-    if (!m_shouldHandleActivityStateChangeCallbacks)
-        return;
-
-    [CATransaction addCommitHandler:[weakThis = makeWeakPtr(*this)] {
-        if (!weakThis)
-            return;
-
-        auto strongPage = makeRef(weakThis->m_webPage);
-        auto* drawingArea = static_cast<TiledCoreAnimationDrawingArea*>(strongPage->drawingArea());
-        ASSERT(weakThis.get() == drawingArea);
-        if (drawingArea != weakThis.get())
-            return;
-
-        if (!drawingArea->m_shouldHandleActivityStateChangeCallbacks)
-            return;
-        drawingArea->m_shouldHandleActivityStateChangeCallbacks = false;
-
-        if (drawingArea->m_activityStateChangeID != ActivityStateChangeAsynchronous)
-            strongPage->send(Messages::WebPageProxy::DidUpdateActivityState());
-
-        for (auto& callbackID : drawingArea->m_nextActivityStateChangeCallbackIDs)
-            strongPage->send(Messages::WebPageProxy::VoidCallback(callbackID));
-        drawingArea->m_nextActivityStateChangeCallbackIDs.clear();
-
-        drawingArea->m_activityStateChangeID = ActivityStateChangeAsynchronous;
-    } forPhase:kCATransactionPhasePostCommit];
-}
-
 void TiledCoreAnimationDrawingArea::setNeedsDisplay()
 {
 }
@@ -521,7 +492,6 @@
         }
 
         sendDidFirstLayerFlushIfNeeded();
-        handleActivityStateChangeCallbacksIfNeeded();
         invalidateRenderingUpdateRunLoopObserver();
     }
 }
@@ -539,9 +509,21 @@
     }
 
     if (m_activityStateChangeID != ActivityStateChangeAsynchronous || !m_nextActivityStateChangeCallbackIDs.isEmpty())
-        m_shouldHandleActivityStateChangeCallbacks = true;
+        m_sendDidUpdateActivityStateTimer.startOneShot(0_s);
+}
 
-    scheduleRenderingUpdate();
+void TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired()
+{
+    [CATransaction flush];
+
+    if (m_activityStateChangeID != ActivityStateChangeAsynchronous)
+        m_webPage.send(Messages::WebPageProxy::DidUpdateActivityState());
+
+    for (const auto& callbackID : m_nextActivityStateChangeCallbackIDs)
+        m_webPage.send(Messages::WebPageProxy::VoidCallback(callbackID));
+
+    m_nextActivityStateChangeCallbackIDs.clear();
+    m_activityStateChangeID = ActivityStateChangeAsynchronous;
 }
 
 void TiledCoreAnimationDrawingArea::suspendPainting()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to