Title: [270410] trunk/Source/WebCore
Revision
270410
Author
[email protected]
Date
2020-12-03 15:15:05 -0800 (Thu, 03 Dec 2020)

Log Message

ASSERTION FAILED: isMainThread() in WTF::Optional<IntSize> &WebCore::surfaceMaximumSize()
https://bugs.webkit.org/show_bug.cgi?id=219492

Reviewed by Ryosuke Niwa.

No new tests; fixes a failing test.

* platform/graphics/cocoa/IOSurface.mm:
(WebCore::surfaceMaximumSize):
(WebCore::IOSurface::setMaximumSize):
(WebCore::IOSurface::maximumSize):
maximumSize() is used off the main thread, so wrap it in a WTF::Atomic.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270409 => 270410)


--- trunk/Source/WebCore/ChangeLog	2020-12-03 23:09:48 UTC (rev 270409)
+++ trunk/Source/WebCore/ChangeLog	2020-12-03 23:15:05 UTC (rev 270410)
@@ -1,3 +1,18 @@
+2020-12-03  Tim Horton  <[email protected]>
+
+        ASSERTION FAILED: isMainThread() in WTF::Optional<IntSize> &WebCore::surfaceMaximumSize()
+        https://bugs.webkit.org/show_bug.cgi?id=219492
+
+        Reviewed by Ryosuke Niwa.
+
+        No new tests; fixes a failing test.
+
+        * platform/graphics/cocoa/IOSurface.mm:
+        (WebCore::surfaceMaximumSize):
+        (WebCore::IOSurface::setMaximumSize):
+        (WebCore::IOSurface::maximumSize):
+        maximumSize() is used off the main thread, so wrap it in a WTF::Atomic.
+
 2020-12-03  Chris Dumez  <[email protected]>
 
         Crash when trying to suspend an OfflineAudioContext with a bad buffer

Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (270409 => 270410)


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2020-12-03 23:09:48 UTC (rev 270409)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2020-12-03 23:15:05 UTC (rev 270410)
@@ -242,24 +242,27 @@
     return maxSize.constrainedBetween({ maxSurfaceDimensionLowerBound, maxSurfaceDimensionLowerBound }, { maxSurfaceDimension, maxSurfaceDimension });
 }
 
-static WTF::Optional<IntSize>& surfaceMaximumSize()
+static WTF::Atomic<IntSize>& surfaceMaximumSize()
 {
-    ASSERT(isMainThread());
-    static WTF::Optional<IntSize> maximumSize;
+    static WTF::Atomic<IntSize> maximumSize;
     return maximumSize;
 }
 
 void IOSurface::setMaximumSize(IntSize size)
 {
-    surfaceMaximumSize() = size;
+    ASSERT(!size.isEmpty());
+    surfaceMaximumSize().store(size);
 }
 
 IntSize IOSurface::maximumSize()
 {
-    auto& size = surfaceMaximumSize();
-    if (!size)
-        size = computeMaximumSurfaceSize();
-    return *size;
+    auto size = surfaceMaximumSize().load();
+    if (size.isEmpty()) {
+        auto computedSize = computeMaximumSurfaceSize();
+        surfaceMaximumSize().store(computedSize);
+        return computedSize;
+    }
+    return size;
 }
 
 MachSendRight IOSurface::createSendRight() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to