Title: [275134] trunk/Source
Revision
275134
Author
[email protected]
Date
2021-03-27 09:01:48 -0700 (Sat, 27 Mar 2021)

Log Message

Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
https://bugs.webkit.org/show_bug.cgi?id=223837

Reviewed by Tim Horton.
Source/WebCore:

handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
all subclasses of DisplayRefreshMonitor with that detail.

* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
(WebCore::DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread): Deleted.
* platform/graphics/DisplayRefreshMonitor.h:
* platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
(WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
* platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired):
* platform/graphics/win/DisplayRefreshMonitorWin.cpp:
(WebCore::DisplayRefreshMonitorWin::displayLinkFired):

Source/WebKit:

handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
all subclasses of DisplayRefreshMonitor with that detail.

* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
(WebKit::DisplayRefreshMonitorMac::displayLinkFired):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275133 => 275134)


--- trunk/Source/WebCore/ChangeLog	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/ChangeLog	2021-03-27 16:01:48 UTC (rev 275134)
@@ -1,3 +1,27 @@
+2021-03-27  Simon Fraser  <[email protected]>
+
+        Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
+        https://bugs.webkit.org/show_bug.cgi?id=223837
+
+        Reviewed by Tim Horton.
+
+        handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
+        the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
+        all subclasses of DisplayRefreshMonitor with that detail.
+
+        * platform/graphics/DisplayRefreshMonitor.cpp:
+        (WebCore::DisplayRefreshMonitor::displayDidRefresh):
+        (WebCore::DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread): Deleted.
+        * platform/graphics/DisplayRefreshMonitor.h:
+        * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp:
+        (WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
+        * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
+        (WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
+        * platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
+        (WebCore::LegacyDisplayRefreshMonitorMac::displayLinkFired):
+        * platform/graphics/win/DisplayRefreshMonitorWin.cpp:
+        (WebCore::DisplayRefreshMonitorWin::displayLinkFired):
+
 2021-03-27  Zalan Bujtas  <[email protected]>
 
         [Multicolumn] Do not try to re-validate a multicol spanner when the renderer is moved internally

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (275133 => 275134)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2021-03-27 16:01:48 UTC (rev 275134)
@@ -80,12 +80,6 @@
 
 DisplayRefreshMonitor::~DisplayRefreshMonitor() = default;
 
-void DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread(void* data)
-{
-    DisplayRefreshMonitor* monitor = static_cast<DisplayRefreshMonitor*>(data);
-    monitor->displayDidRefresh();
-}
-
 void DisplayRefreshMonitor::addClient(DisplayRefreshMonitorClient& client)
 {
     m_clients.add(&client);
@@ -100,6 +94,8 @@
 
 void DisplayRefreshMonitor::displayDidRefresh()
 {
+    ASSERT(isMainRunLoop());
+
     {
         LockHolder lock(m_mutex);
         LOG_WITH_STREAM(DisplayLink, stream << "DisplayRefreshMonitor " << this << " displayDidRefresh for display " << displayID() << " scheduled " << m_scheduled << " unscheduledFireCount " << m_unscheduledFireCount);

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (275133 => 275134)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h	2021-03-27 16:01:48 UTC (rev 275134)
@@ -71,7 +71,6 @@
 
 protected:
     WEBCORE_EXPORT explicit DisplayRefreshMonitor(PlatformDisplayID);
-    WEBCORE_EXPORT static void handleDisplayRefreshedNotificationOnMainThread(void* data);
 
     friend class DisplayRefreshMonitorManager;
     
@@ -87,9 +86,9 @@
     void setIsPreviousFrameDone(bool done) { m_previousFrameDone = done; }
 
     virtual bool hasRequestedRefreshCallback() const { return false; }
+    WEBCORE_EXPORT void displayDidRefresh();
 
 private:
-    void displayDidRefresh();
 
     HashSet<DisplayRefreshMonitorClient*> m_clients;
     HashSet<DisplayRefreshMonitorClient*>* m_clientsToBeNotified { nullptr };

Modified: trunk/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp (275133 => 275134)


--- trunk/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp	2021-03-27 16:01:48 UTC (rev 275134)
@@ -89,7 +89,7 @@
         setIsPreviousFrameDone(false);
     }
     ASSERT(isMainThread());
-    handleDisplayRefreshedNotificationOnMainThread(this);
+    displayDidRefresh();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm (275133 => 275134)


--- trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/platform/graphics/ios/DisplayRefreshMonitorIOS.mm	2021-03-27 16:01:48 UTC (rev 275134)
@@ -118,7 +118,7 @@
         return;
 
     setIsPreviousFrameDone(false);
-    handleDisplayRefreshedNotificationOnMainThread(this);
+    displayDidRefresh();
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp (275133 => 275134)


--- trunk/Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp	2021-03-27 16:01:48 UTC (rev 275134)
@@ -99,7 +99,7 @@
 
     RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] {
         if (m_displayLink)
-            handleDisplayRefreshedNotificationOnMainThread(this);
+            displayDidRefresh();
     });
 }
 

Modified: trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.cpp (275133 => 275134)


--- trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.cpp	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.cpp	2021-03-27 16:01:48 UTC (rev 275134)
@@ -55,8 +55,7 @@
         return;
 
     setIsPreviousFrameDone(false);
-
-    handleDisplayRefreshedNotificationOnMainThread(this);
+    displayDidRefresh();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (275133 => 275134)


--- trunk/Source/WebKit/ChangeLog	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebKit/ChangeLog	2021-03-27 16:01:48 UTC (rev 275134)
@@ -1,3 +1,19 @@
+2021-03-27  Simon Fraser  <[email protected]>
+
+        Remove DisplayRefreshMonitor::handleDisplayRefreshedNotificationOnMainThread()
+        https://bugs.webkit.org/show_bug.cgi?id=223837
+
+        Reviewed by Tim Horton.
+        
+        handleDisplayRefreshedNotificationOnMainThread() is an anachronism left over from
+        the non-main-thread nature of the CVDisplayLink callback. There's no need to burden
+        all subclasses of DisplayRefreshMonitor with that detail.
+
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
+        (WebKit::RemoteLayerTreeDisplayRefreshMonitor::didUpdateLayers):
+        * WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp:
+        (WebKit::DisplayRefreshMonitorMac::displayLinkFired):
+
 2021-03-26  Patrick Angle  <[email protected]>
 
         Web Inspector: Grid layout labels can be drawn outside the viewport

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm (275133 => 275134)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm	2021-03-27 16:01:48 UTC (rev 275134)
@@ -68,7 +68,7 @@
         return;
 
     setIsPreviousFrameDone(false);
-    handleDisplayRefreshedNotificationOnMainThread(this);
+    displayDidRefresh();
 }
 
 void RemoteLayerTreeDisplayRefreshMonitor::updateDrawingArea(RemoteLayerTreeDrawingArea& drawingArea)

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp (275133 => 275134)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp	2021-03-27 13:51:18 UTC (rev 275133)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/DisplayRefreshMonitorMac.cpp	2021-03-27 16:01:48 UTC (rev 275134)
@@ -76,12 +76,12 @@
     ASSERT(isMainRunLoop());
     if (!m_firstCallbackInCurrentRunloop)
         return;
+
     m_firstCallbackInCurrentRunloop = false;
 
     LOG_WITH_STREAM(DisplayLink, stream << "DisplayRefreshMonitorMac::displayLinkFired() for display " << displayID());
 
-    // Since we are on the main thread, we can just call handleDisplayRefreshedNotificationOnMainThread here.
-    handleDisplayRefreshedNotificationOnMainThread(this);
+    displayDidRefresh();
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to