Title: [133232] trunk/Source
Revision
133232
Author
a...@apple.com
Date
2012-11-01 15:26:55 -0700 (Thu, 01 Nov 2012)

Log Message

        Fix HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) build
        https://bugs.webkit.org/show_bug.cgi?id=100979

        Reviewed by Joseph Pecoraro.

        * loader/ResourceBuffer.cpp: (WebCore::ResourceBuffer::append):
        * loader/ResourceBuffer.h:
        Added a version of append() that takes CFDataRef, passing it directly to SharedBuffer.

        * loader/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::didReceiveDataArray):
        InspectorInstrumentation now takes a length. Unfortunately, we don't have encodedLength
        here, meaning that the results will likely be incorrect.

        * platform/network/cf/ResourceHandleCFNet.cpp:
        (WebCore::willCacheResponse): Removed a version that needlessly used deprecated API.
        (WebCore::ResourceHandle::createCFURLConnection): This code assumed that
        HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) and USE(PROTECTION_SPACE_AUTH_CALLBACK) always
        come together. Changed to check for these separately.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (133231 => 133232)


--- trunk/Source/WTF/ChangeLog	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WTF/ChangeLog	2012-11-01 22:26:55 UTC (rev 133232)
@@ -1,3 +1,12 @@
+2012-11-01  Alexey Proskuryakov  <a...@apple.com>
+
+        Fix HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) build
+        https://bugs.webkit.org/show_bug.cgi?id=100979
+
+        Reviewed by Joseph Pecoraro.
+
+        * wtf/Platform.h: Added a FIXME about HAVE(NETWORK_CFDATA_ARRAY_CALLBACK).
+
 2012-11-01  Yury Semikhatsky  <yu...@chromium.org>
 
         Memory instrumentation: report memory occupied by ResourceRequest instead of its base ResourceRequestBase

Modified: trunk/Source/WTF/wtf/Platform.h (133231 => 133232)


--- trunk/Source/WTF/wtf/Platform.h	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WTF/wtf/Platform.h	2012-11-01 22:26:55 UTC (rev 133232)
@@ -592,7 +592,7 @@
 #define ENABLE_ORIENTATION_EVENTS 1
 #define ENABLE_REPAINT_THROTTLING 1
 #define ENABLE_WEB_ARCHIVE 1
-#define HAVE_NETWORK_CFDATA_ARRAY_CALLBACK 1
+#define HAVE_NETWORK_CFDATA_ARRAY_CALLBACK 1 // FIXME: All CFNetwork based platforms have this callback now, so it should be USE, not HAVE.
 #define HAVE_PTHREAD_RWLOCK 1
 #define HAVE_READLINE 1
 #define WTF_USE_CF 1

Modified: trunk/Source/WebCore/ChangeLog (133231 => 133232)


--- trunk/Source/WebCore/ChangeLog	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WebCore/ChangeLog	2012-11-01 22:26:55 UTC (rev 133232)
@@ -1,3 +1,24 @@
+2012-11-01  Alexey Proskuryakov  <a...@apple.com>
+
+        Fix HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) build
+        https://bugs.webkit.org/show_bug.cgi?id=100979
+
+        Reviewed by Joseph Pecoraro.
+
+        * loader/ResourceBuffer.cpp: (WebCore::ResourceBuffer::append):
+        * loader/ResourceBuffer.h:
+        Added a version of append() that takes CFDataRef, passing it directly to SharedBuffer.
+
+        * loader/mac/ResourceLoaderMac.mm: (WebCore::ResourceLoader::didReceiveDataArray):
+        InspectorInstrumentation now takes a length. Unfortunately, we don't have encodedLength
+        here, meaning that the results will likely be incorrect.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::willCacheResponse): Removed a version that needlessly used deprecated API.
+        (WebCore::ResourceHandle::createCFURLConnection): This code assumed that
+        HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) and USE(PROTECTION_SPACE_AUTH_CALLBACK) always
+        come together. Changed to check for these separately.
+
 2012-11-01  Rob Buis  <rb...@rim.com>
 
         [BlackBerry] Add more form validation strings

Modified: trunk/Source/WebCore/loader/ResourceBuffer.cpp (133231 => 133232)


--- trunk/Source/WebCore/loader/ResourceBuffer.cpp	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WebCore/loader/ResourceBuffer.cpp	2012-11-01 22:26:55 UTC (rev 133232)
@@ -112,6 +112,13 @@
 }
 #endif
 
+#if HAVE(NETWORK_CFDATA_ARRAY_CALLBACK)
+void ResourceBuffer::append(CFDataRef dataRef)
+{
+    m_sharedBuffer->append(dataRef);
+}
+#endif
+
 void ResourceBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this);

Modified: trunk/Source/WebCore/loader/ResourceBuffer.h (133231 => 133232)


--- trunk/Source/WebCore/loader/ResourceBuffer.h	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WebCore/loader/ResourceBuffer.h	2012-11-01 22:26:55 UTC (rev 133232)
@@ -73,6 +73,9 @@
 #if USE(CF)
     CFDataRef createCFData();
 #endif
+#if HAVE(NETWORK_CFDATA_ARRAY_CALLBACK)
+    void append(CFDataRef);
+#endif
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
 

Modified: trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm (133231 => 133232)


--- trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WebCore/loader/mac/ResourceLoaderMac.mm	2012-11-01 22:26:55 UTC (rev 133232)
@@ -83,7 +83,7 @@
 
         if (m_options.shouldBufferData == BufferData) {
             if (!m_resourceData)
-                m_resourceData = SharedBuffer::create();
+                m_resourceData = ResourceBuffer::create();
             m_resourceData->append(data);
         }
 
@@ -97,7 +97,16 @@
 
 void ResourceLoader::didReceiveDataArray(ResourceHandle*, CFArrayRef dataArray)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier());
+    CFIndex arrayCount = CFArrayGetCount(dataArray);
+    CFIndex dataLength = 0;
+    for (CFIndex i = 0; i < arrayCount; ++i) {
+        CFDataRef data = "" i));
+        dataLength += CFDataGetLength(data);
+    }
+
+    // FIXME: didReceiveData() passes encoded data length to InspectorInstrumentation, but it is not available here.
+    // This probably results in incorrect size being displayed in Web Inspector.
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceData(m_frame.get(), identifier(), dataLength);
     didReceiveDataArray(dataArray);
     InspectorInstrumentation::didReceiveResourceData(cookie);
 }

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


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2012-11-01 22:23:59 UTC (rev 133231)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2012-11-01 22:26:55 UTC (rev 133232)
@@ -342,20 +342,12 @@
         handle->client()->willCacheResponse(handle, policy);
 
     if (static_cast<CFURLCacheStoragePolicy>(policy) != CFCachedURLResponseGetStoragePolicy(cachedResponse)) {
-#if HAVE(NETWORK_CFDATA_ARRAY_CALLBACK)
         RetainPtr<CFArrayRef> receiverData(AdoptCF, CFCachedURLResponseCopyReceiverDataArray(cachedResponse));
         cachedResponse = CFCachedURLResponseCreateWithDataArray(kCFAllocatorDefault,
                                                                 wrappedResponse,
                                                                 receiverData.get(),
                                                                 CFCachedURLResponseGetUserInfo(cachedResponse),
                                                                 static_cast<CFURLCacheStoragePolicy>(policy));
-#else
-        cachedResponse = CFCachedURLResponseCreateWithUserInfo(kCFAllocatorDefault, 
-                                                               wrappedResponse,
-                                                               CFCachedURLResponseGetReceiverData(cachedResponse),
-                                                               CFCachedURLResponseGetUserInfo(cachedResponse), 
-                                                               static_cast<CFURLCacheStoragePolicy>(policy));
-#endif
     } else
         CFRetain(cachedResponse);
 
@@ -499,11 +491,19 @@
 
     RetainPtr<CFURLRequestRef> request(AdoptCF, makeFinalRequest(firstRequest(), shouldContentSniff));
 
-#if HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) && USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    CFURLConnectionClient_V6 client = { 6, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0, canRespondToProtectionSpace, 0, didReceiveDataArray};
+    CFURLConnectionClient_V6 client = { 6, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0,
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+        canRespondToProtectionSpace,
 #else
-    CFURLConnectionClient_V3 client = { 3, this, 0, 0, 0, WebCore::willSendRequest, didReceiveResponse, didReceiveData, 0, didFinishLoading, didFail, willCacheResponse, didReceiveChallenge, didSendBodyData, shouldUseCredentialStorageCallback, 0};
+        0,
 #endif
+        0,
+#if HAVE(NETWORK_CFDATA_ARRAY_CALLBACK)
+        didReceiveDataArray
+#else 
+        0
+#endif
+    };
     RetainPtr<CFDictionaryRef> connectionProperties(AdoptCF, createConnectionProperties(shouldUseCredentialStorage));
 
     d->m_connection.adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast<CFURLConnectionClient*>(&client), connectionProperties.get()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to