Title: [171619] trunk/Source/WebCore
Revision
171619
Author
[email protected]
Date
2014-07-25 14:53:26 -0700 (Fri, 25 Jul 2014)

Log Message

[iOS] REGRESSION(r171526): Images fail to load sometimes
https://bugs.webkit.org/show_bug.cgi?id=135304
<rdar://problem/17811922>

Reviewed by Alexey Proskuryakov.

SharedBuffer::createCFData() calls data() as a way to coalesce the data array elements and
segments into m_buffer. However, data() has an optimization where if we had a single element
in the data array, it would just return that and not do coalescing. So when we passed
m_buffer to WebCoreSharedData, we passed a buffer with no data in it.

Fix this by bringing the optimization to createCFData() and return the CFDataRef from the
data array if we just have a single element.

No new tests. Should be covered by existing tests.

* platform/mac/SharedBufferMac.mm:
(WebCore::SharedBuffer::createCFData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (171618 => 171619)


--- trunk/Source/WebCore/ChangeLog	2014-07-25 21:49:12 UTC (rev 171618)
+++ trunk/Source/WebCore/ChangeLog	2014-07-25 21:53:26 UTC (rev 171619)
@@ -1,3 +1,24 @@
+2014-07-25  Pratik Solanki  <[email protected]>
+
+        [iOS] REGRESSION(r171526): Images fail to load sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=135304
+        <rdar://problem/17811922>
+
+        Reviewed by Alexey Proskuryakov.
+
+        SharedBuffer::createCFData() calls data() as a way to coalesce the data array elements and
+        segments into m_buffer. However, data() has an optimization where if we had a single element
+        in the data array, it would just return that and not do coalescing. So when we passed
+        m_buffer to WebCoreSharedData, we passed a buffer with no data in it.
+
+        Fix this by bringing the optimization to createCFData() and return the CFDataRef from the
+        data array if we just have a single element.
+
+        No new tests. Should be covered by existing tests.
+
+        * platform/mac/SharedBufferMac.mm:
+        (WebCore::SharedBuffer::createCFData):
+
 2014-07-25  Jer Noble  <[email protected]>
 
         [MSE] High CPU usage in SampleMap::findSamplesWithinPresentationRange() with a large number of buffered samples.

Modified: trunk/Source/WebCore/platform/mac/SharedBufferMac.mm (171618 => 171619)


--- trunk/Source/WebCore/platform/mac/SharedBufferMac.mm	2014-07-25 21:49:12 UTC (rev 171618)
+++ trunk/Source/WebCore/platform/mac/SharedBufferMac.mm	2014-07-25 21:53:26 UTC (rev 171619)
@@ -105,6 +105,11 @@
     if (m_cfData)
         return m_cfData;
 
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+    if (m_dataArray.size() == 1)
+        return m_dataArray.at(0);
+#endif
+
     data(); // Force data into m_buffer from segments or data array.
     if (hasPurgeableBuffer()) {
         RefPtr<SharedBuffer::DataBuffer> copiedBuffer = adoptRef(new DataBuffer);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to