Title: [251771] trunk/Source/WebCore
Revision
251771
Author
carlo...@webkit.org
Date
2019-10-30 00:59:03 -0700 (Wed, 30 Oct 2019)

Log Message

ImageDecoders: use a thread safe data buffer for Cairo backing store
https://bugs.webkit.org/show_bug.cgi?id=201727
<rdar://problem/56665041>

Reviewed by Fujii Hironori.

Use SharedBuffer::dataSegment which is ThreadSafeRefCounted.

* platform/graphics/ImageBackingStore.h:
(WebCore::ImageBackingStore::setSize):
(WebCore::ImageBackingStore::ImageBackingStore):
* platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
(WebCore::ImageBackingStore::image const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (251770 => 251771)


--- trunk/Source/WebCore/ChangeLog	2019-10-30 07:58:26 UTC (rev 251770)
+++ trunk/Source/WebCore/ChangeLog	2019-10-30 07:59:03 UTC (rev 251771)
@@ -1,3 +1,19 @@
+2019-10-30  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        ImageDecoders: use a thread safe data buffer for Cairo backing store
+        https://bugs.webkit.org/show_bug.cgi?id=201727
+        <rdar://problem/56665041>
+
+        Reviewed by Fujii Hironori.
+
+        Use SharedBuffer::dataSegment which is ThreadSafeRefCounted.
+
+        * platform/graphics/ImageBackingStore.h:
+        (WebCore::ImageBackingStore::setSize):
+        (WebCore::ImageBackingStore::ImageBackingStore):
+        * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
+        (WebCore::ImageBackingStore::image const):
+
 2019-10-29  Ryosuke Niwa  <rn...@webkit.org>
 
         Remove HTMLMediaElementDestructorScope

Modified: trunk/Source/WebCore/platform/graphics/ImageBackingStore.h (251770 => 251771)


--- trunk/Source/WebCore/platform/graphics/ImageBackingStore.h	2019-10-30 07:58:26 UTC (rev 251770)
+++ trunk/Source/WebCore/platform/graphics/ImageBackingStore.h	2019-10-30 07:59:03 UTC (rev 251771)
@@ -66,7 +66,7 @@
             return false;
 
         buffer.grow(bufferSize);
-        m_pixels = SharedBuffer::create(WTFMove(buffer));
+        m_pixels = SharedBuffer::DataSegment::create(WTFMove(buffer));
         m_pixelsPtr = reinterpret_cast<RGBA32*>(const_cast<char*>(m_pixels->data()));
         m_size = size;
         m_frameRect = IntRect(IntPoint(), m_size);
@@ -201,7 +201,9 @@
         , m_premultiplyAlpha(other.m_premultiplyAlpha)
     {
         ASSERT(!m_size.isEmpty() && !isOverSize(m_size));
-        m_pixels = SharedBuffer::create(other.m_pixels->data(), other.m_pixels->size());
+        Vector<char> buffer;
+        buffer.append(other.m_pixels->data(), other.m_pixels->size());
+        m_pixels = SharedBuffer::DataSegment::create(WTFMove(buffer));
         m_pixelsPtr = reinterpret_cast<RGBA32*>(const_cast<char*>(m_pixels->data()));
     }
 
@@ -226,7 +228,7 @@
         return makeRGBA(r, g, b, a);
     }
 
-    RefPtr<SharedBuffer> m_pixels;
+    RefPtr<SharedBuffer::DataSegment> m_pixels;
     RGBA32* m_pixelsPtr { nullptr };
     IntSize m_size;
     IntRect m_frameRect; // This will always just be the entire buffer except for GIF and PNG frames

Modified: trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp (251770 => 251771)


--- trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp	2019-10-30 07:58:26 UTC (rev 251770)
+++ trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp	2019-10-30 07:59:03 UTC (rev 251771)
@@ -37,7 +37,7 @@
         reinterpret_cast<unsigned char*>(const_cast<uint32_t*>(m_pixelsPtr)),
         CAIRO_FORMAT_ARGB32, size().width(), size().height(), size().width() * sizeof(uint32_t)));
     static cairo_user_data_key_t s_surfaceDataKey;
-    cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, m_pixels.get(), [](void* data) { static_cast<SharedBuffer*>(data)->deref(); });
+    cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, m_pixels.get(), [](void* data) { static_cast<SharedBuffer::DataSegment*>(data)->deref(); });
 
     return surface;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to