Title: [295402] trunk/Source/WebCore
Revision
295402
Author
s...@apple.com
Date
2022-06-08 17:18:27 -0700 (Wed, 08 Jun 2022)

Log Message

REGRESSION(r295372): [Win, WinCairo] 30 tests crash when creating ImageData
https://bugs.webkit.org/show_bug.cgi?id=241429

Reviewed by Simon Fraser.

It looks the move construct is different on Windows when we pass an xvalue
(such as WTFMove(pixelBuffer)) to a function which takes an lvalue
(such as Ref<JSC::Uint8ClampedArray> data(Ref<ByteArrayPixelBuffer>)). Or it
might be a compiler bug.

So revert the change which converted ByteArrayPixelBuffer::takeData() to
ByteArrayPixelBuffer::data() since it is not related to the fix of bug 240810.

* Source/WebCore/html/ImageData.cpp:
(WebCore::ImageData::create):
* Source/WebCore/platform/graphics/ByteArrayPixelBuffer.cpp:
(WebCore::ByteArrayPixelBuffer::data): Deleted.
* Source/WebCore/platform/graphics/ByteArrayPixelBuffer.h:
(WebCore::ByteArrayPixelBuffer::takeData):

Canonical link: https://commits.webkit.org/251408@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/html/ImageData.cpp (295401 => 295402)


--- trunk/Source/WebCore/html/ImageData.cpp	2022-06-08 23:50:03 UTC (rev 295401)
+++ trunk/Source/WebCore/html/ImageData.cpp	2022-06-09 00:18:27 UTC (rev 295402)
@@ -53,7 +53,7 @@
 Ref<ImageData> ImageData::create(Ref<ByteArrayPixelBuffer>&& pixelBuffer)
 {
     auto colorSpace = toPredefinedColorSpace(pixelBuffer->format().colorSpace);
-    return adoptRef(*new ImageData(pixelBuffer->size(), ByteArrayPixelBuffer::data(WTFMove(pixelBuffer)), *colorSpace));
+    return adoptRef(*new ImageData(pixelBuffer->size(), pixelBuffer->takeData(), *colorSpace));
 }
 
 RefPtr<ImageData> ImageData::create(RefPtr<ByteArrayPixelBuffer>&& pixelBuffer)

Modified: trunk/Source/WebCore/platform/graphics/ByteArrayPixelBuffer.cpp (295401 => 295402)


--- trunk/Source/WebCore/platform/graphics/ByteArrayPixelBuffer.cpp	2022-06-08 23:50:03 UTC (rev 295401)
+++ trunk/Source/WebCore/platform/graphics/ByteArrayPixelBuffer.cpp	2022-06-09 00:18:27 UTC (rev 295402)
@@ -87,13 +87,6 @@
 {
 }
 
-Ref<JSC::Uint8ClampedArray> ByteArrayPixelBuffer::data(Ref<ByteArrayPixelBuffer> pixelBuffer)
-{
-    if (pixelBuffer->hasOneRef())
-        return WTFMove(pixelBuffer->m_data);
-    return pixelBuffer->m_data;
-}
-
 RefPtr<PixelBuffer> ByteArrayPixelBuffer::createScratchPixelBuffer(const IntSize& size) const
 {
     return ByteArrayPixelBuffer::tryCreate(m_format, size);

Modified: trunk/Source/WebCore/platform/graphics/ByteArrayPixelBuffer.h (295401 => 295402)


--- trunk/Source/WebCore/platform/graphics/ByteArrayPixelBuffer.h	2022-06-08 23:50:03 UTC (rev 295401)
+++ trunk/Source/WebCore/platform/graphics/ByteArrayPixelBuffer.h	2022-06-09 00:18:27 UTC (rev 295402)
@@ -38,7 +38,7 @@
     WEBCORE_EXPORT static RefPtr<ByteArrayPixelBuffer> tryCreate(const PixelBufferFormat&, const IntSize&, Ref<JSC::ArrayBuffer>&&);
 
     JSC::Uint8ClampedArray& data() const { return m_data.get(); }
-    static Ref<JSC::Uint8ClampedArray> data(Ref<ByteArrayPixelBuffer>);
+    Ref<JSC::Uint8ClampedArray>&& takeData() { return WTFMove(m_data); }
 
     RefPtr<PixelBuffer> createScratchPixelBuffer(const IntSize&) const override;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to