Title: [135221] trunk/Source/WebCore
Revision
135221
Author
[email protected]
Date
2012-11-19 17:55:10 -0800 (Mon, 19 Nov 2012)

Log Message

For single element arrays use the pointer into the CFDataRef instead of copying data
https://bugs.webkit.org/show_bug.cgi?id=102306

Reviewed by Brent Fulgham.

Address review comments for slightly nicer code.

* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::data):
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::singleDataArrayBuffer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135220 => 135221)


--- trunk/Source/WebCore/ChangeLog	2012-11-20 01:53:54 UTC (rev 135220)
+++ trunk/Source/WebCore/ChangeLog	2012-11-20 01:55:10 UTC (rev 135221)
@@ -1,3 +1,17 @@
+2012-11-19  Pratik Solanki  <[email protected]>
+
+        For single element arrays use the pointer into the CFDataRef instead of copying data
+        https://bugs.webkit.org/show_bug.cgi?id=102306
+
+        Reviewed by Brent Fulgham.
+
+        Address review comments for slightly nicer code.
+
+        * platform/SharedBuffer.cpp:
+        (WebCore::SharedBuffer::data):
+        * platform/cf/SharedBufferCF.cpp:
+        (WebCore::SharedBuffer::singleDataArrayBuffer):
+
 2012-11-19  Chris Rogers  <[email protected]>
 
         Remove empirical bass-boost for HRTF spatialization

Modified: trunk/Source/WebCore/platform/SharedBuffer.cpp (135220 => 135221)


--- trunk/Source/WebCore/platform/SharedBuffer.cpp	2012-11-20 01:53:54 UTC (rev 135220)
+++ trunk/Source/WebCore/platform/SharedBuffer.cpp	2012-11-20 01:55:10 UTC (rev 135221)
@@ -146,15 +146,14 @@
         return platformData();
 
 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    const char* directBuffer = singleDataArrayBuffer();
-    if (directBuffer)
-        return directBuffer;
+    if (const char* buffer = singleDataArrayBuffer())
+        return buffer;
 #endif
     
     if (m_purgeableBuffer)
         return m_purgeableBuffer->data();
     
-    return buffer().data();
+    return this->buffer().data();
 }
 
 void SharedBuffer::append(SharedBuffer* data)

Modified: trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp (135220 => 135221)


--- trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp	2012-11-20 01:53:54 UTC (rev 135220)
+++ trunk/Source/WebCore/platform/cf/SharedBufferCF.cpp	2012-11-20 01:55:10 UTC (rev 135221)
@@ -140,10 +140,10 @@
     if (m_buffer.size())
         return 0;
 
-    if (m_dataArray.size() == 1)
-        return reinterpret_cast<const char*>(CFDataGetBytePtr(m_dataArray.at(0).get()));
+    if (m_dataArray.size() != 1)
+        return 0;
 
-    return 0;
+    return reinterpret_cast<const char*>(CFDataGetBytePtr(m_dataArray.at(0).get()));
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to