Title: [271943] trunk/Source/WebCore
Revision
271943
Author
[email protected]
Date
2021-01-27 03:06:21 -0800 (Wed, 27 Jan 2021)

Log Message

REGRESSION(r271929): MobileSafari hangs upon launch due to a trivial deadlock in IOSurfacePool::setPoolSize
https://bugs.webkit.org/show_bug.cgi?id=221027

Reviewed by Tim Horton.

Avoid the deadlock by not grabbing the lock in IOSurfacePool::evict when discarding all surfaces.
To do this, we extract the code in discardAllSurfaces as discardAllSurfacesInternal and use it in evict.

* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::IOSurfacePool::evict): Calls discardAllSurfacesInternal.
(WebCore::IOSurfacePool::discardAllSurfaces):
(WebCore::IOSurfacePool::discardAllSurfacesInternal): Extracted out of discardAllSurfaces.
* platform/graphics/cg/IOSurfacePool.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271942 => 271943)


--- trunk/Source/WebCore/ChangeLog	2021-01-27 11:04:22 UTC (rev 271942)
+++ trunk/Source/WebCore/ChangeLog	2021-01-27 11:06:21 UTC (rev 271943)
@@ -1,3 +1,19 @@
+2021-01-27  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r271929): MobileSafari hangs upon launch due to a trivial deadlock in IOSurfacePool::setPoolSize
+        https://bugs.webkit.org/show_bug.cgi?id=221027
+
+        Reviewed by Tim Horton.
+
+        Avoid the deadlock by not grabbing the lock in IOSurfacePool::evict when discarding all surfaces.
+        To do this, we extract the code in discardAllSurfaces as discardAllSurfacesInternal and use it in evict.
+
+        * platform/graphics/cg/IOSurfacePool.cpp:
+        (WebCore::IOSurfacePool::evict): Calls discardAllSurfacesInternal.
+        (WebCore::IOSurfacePool::discardAllSurfaces):
+        (WebCore::IOSurfacePool::discardAllSurfacesInternal): Extracted out of discardAllSurfaces.
+        * platform/graphics/cg/IOSurfacePool.h:
+
 2021-01-27  Imanol Fernandez  <[email protected]>
 
         Complete WebXRRigidTransform implementation

Modified: trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp (271942 => 271943)


--- trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp	2021-01-27 11:04:22 UTC (rev 271942)
+++ trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp	2021-01-27 11:06:21 UTC (rev 271943)
@@ -241,7 +241,7 @@
     DUMP_POOL_STATISTICS("before evict");
 
     if (additionalSize >= m_maximumBytesCached) {
-        discardAllSurfaces();
+        discardAllSurfacesInternal();
         DUMP_POOL_STATISTICS("after evict all");
         return;
     }
@@ -326,6 +326,11 @@
 void IOSurfacePool::discardAllSurfaces()
 {
     auto locker = holdLock(m_lock);
+    discardAllSurfacesInternal();
+}
+
+void IOSurfacePool::discardAllSurfacesInternal()
+{
     m_bytesCached = 0;
     m_inUseBytesCached = 0;
     m_surfaceDetails.clear();

Modified: trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h (271942 => 271943)


--- trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h	2021-01-27 11:04:22 UTC (rev 271942)
+++ trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h	2021-01-27 11:06:21 UTC (rev 271943)
@@ -97,6 +97,8 @@
 
     void platformGarbageCollectNow();
 
+    void discardAllSurfacesInternal();
+
     void showPoolStatistics(const char*);
 
     RunLoop::Timer<IOSurfacePool> m_collectionTimer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to