Title: [159235] trunk/Source/WebCore
Revision
159235
Author
[email protected]
Date
2013-11-13 14:06:39 -0800 (Wed, 13 Nov 2013)

Log Message

Update ResourceHandleCF to use the didReceiveBuffer() callback
https://bugs.webkit.org/show_bug.cgi?id=124256

Patch by Benjamin Poulain <[email protected]> on 2013-11-13
Reviewed by Alexey Proskuryakov.

Use didReceiveBuffer() instead of didReceiveData() to pass data back to
the ResourceHandleClient. This unify the update code with the NSURLConnection loader.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::didReceiveData):
(WebCore::ResourceHandle::handleDataArray):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (159234 => 159235)


--- trunk/Source/WebCore/ChangeLog	2013-11-13 22:05:12 UTC (rev 159234)
+++ trunk/Source/WebCore/ChangeLog	2013-11-13 22:06:39 UTC (rev 159235)
@@ -1,3 +1,17 @@
+2013-11-13  Benjamin Poulain  <[email protected]>
+
+        Update ResourceHandleCF to use the didReceiveBuffer() callback
+        https://bugs.webkit.org/show_bug.cgi?id=124256
+
+        Reviewed by Alexey Proskuryakov.
+
+        Use didReceiveBuffer() instead of didReceiveData() to pass data back to
+        the ResourceHandleClient. This unify the update code with the NSURLConnection loader.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::didReceiveData):
+        (WebCore::ResourceHandle::handleDataArray):
+
 2013-11-13  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Split Inspector.json into individual domain json files

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (159234 => 159235)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2013-11-13 22:05:12 UTC (rev 159234)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2013-11-13 22:06:39 UTC (rev 159235)
@@ -214,17 +214,17 @@
 
 static void didReceiveData(CFURLConnectionRef conn, CFDataRef data, CFIndex originalLength, const void* clientInfo)
 {
+    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
+
 #if LOG_DISABLED
     UNUSED_PARAM(conn);
-#endif
-    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
-    const UInt8* bytes = CFDataGetBytePtr(data);
+#else
     CFIndex length = CFDataGetLength(data);
-
     LOG(Network, "CFNet - didReceiveData(conn=%p, handle=%p, bytes=%ld) (%s)", conn, handle, length, handle->firstRequest().url().string().utf8().data());
+#endif
 
-    if (handle->client())
-        handle->client()->didReceiveData(handle, (const char*)bytes, length, originalLength);
+    if (ResourceHandleClient* client = handle->client())
+        client->didReceiveBuffer(handle, SharedBuffer::wrapCFData(data), originalLength);
 }
 
 static void didSendBodyData(CFURLConnectionRef, CFIndex, CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite, const void *clientInfo)
@@ -784,8 +784,7 @@
     ASSERT(count);
     if (count == 1) {
         CFDataRef data = "" 0));
-        CFIndex length = CFDataGetLength(data);
-        client()->didReceiveData(this, reinterpret_cast<const char*>(CFDataGetBytePtr(data)), length, static_cast<int>(length));
+        client()->didReceiveBuffer(this, SharedBuffer::wrapCFData(data), -1);
         return;
     }
 
@@ -800,7 +799,7 @@
         CFDataAppendBytes(mergedData.get(), CFDataGetBytePtr(data), CFDataGetLength(data));
     }
 
-    client()->didReceiveData(this, reinterpret_cast<const char*>(CFDataGetBytePtr(mergedData.get())), totalSize, static_cast<int>(totalSize));
+    client()->didReceiveBuffer(this, SharedBuffer::wrapCFData(mergedData.get()), -1);
 }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to