Stop using didReceiveDataArray callback on El Capitan
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Apr 2017 19:40:58 +0000 (19:40 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Apr 2017 19:40:58 +0000 (19:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170780

Reviewed by Brady Eidson.

Source/WebCore:

didReceiveDataArray was an optimization that improved performance on iOS but is not needed any more.
The only platform where this is used is El Capitan, and didReceiveData works fine on that platform.
I've left some cleanup still to be done in SharedBuffer, and doing that is the motivation for this change.

* WebCore.xcodeproj/project.pbxproj:
* loader/ResourceLoader.h:
* loader/SubresourceLoader.h:
* loader/cf/SubresourceLoaderCF.cpp: Removed.
* loader/mac/ResourceLoaderMac.mm:
(WebCore::ResourceLoader::didReceiveDataArray): Deleted.
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::supportsDataArray): Deleted.
(WebCore::ResourceHandleClient::didReceiveDataArray): Deleted.
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegate::makeConnectionClient):
(WebCore::ResourceHandleCFURLConnectionDelegate::didReceiveDataArrayCallback): Deleted.
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray): Deleted.
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Deleted.
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveDataArray:]): Deleted.

Source/WebKit2:

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::supportsDataArray): Deleted.
(WebKit::NetworkLoad::didReceiveDataArray): Deleted.
* NetworkProcess/NetworkLoad.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@215280 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/cf/SubresourceLoaderCF.cpp [deleted file]
Source/WebCore/loader/mac/ResourceLoaderMac.mm
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkLoad.cpp
Source/WebKit2/NetworkProcess/NetworkLoad.h

index bb04c4a..5c173f4 100644 (file)
@@ -1,3 +1,38 @@
+2017-04-12  Alex Christensen  <achristensen@webkit.org>
+
+        Stop using didReceiveDataArray callback on El Capitan
+        https://bugs.webkit.org/show_bug.cgi?id=170780
+
+        Reviewed by Brady Eidson.
+
+        didReceiveDataArray was an optimization that improved performance on iOS but is not needed any more.
+        The only platform where this is used is El Capitan, and didReceiveData works fine on that platform.
+        I've left some cleanup still to be done in SharedBuffer, and doing that is the motivation for this change.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/ResourceLoader.h:
+        * loader/SubresourceLoader.h:
+        * loader/cf/SubresourceLoaderCF.cpp: Removed.
+        * loader/mac/ResourceLoaderMac.mm:
+        (WebCore::ResourceLoader::didReceiveDataArray): Deleted.
+        * platform/network/ResourceHandleClient.h:
+        (WebCore::ResourceHandleClient::supportsDataArray): Deleted.
+        (WebCore::ResourceHandleClient::didReceiveDataArray): Deleted.
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
+        (WebCore::ResourceHandleCFURLConnectionDelegate::makeConnectionClient):
+        (WebCore::ResourceHandleCFURLConnectionDelegate::didReceiveDataArrayCallback): Deleted.
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
+        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray): Deleted.
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
+        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Deleted.
+        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
+        (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveDataArray:]): Deleted.
+
 2017-04-12  Beth Dakin  <bdakin@apple.com>
 
         Attempted build fix.
index 4b15f94..75a9d94 100644 (file)
                7D4C96DC1AD4483500365A50 /* JSFetchHeaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */; };
                7D4C96DD1AD4483500365A50 /* JSFetchHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */; };
                7D741BDA177226AA00859170 /* CSSValueKeywords.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 6565814809D13043000E61D7 /* CSSValueKeywords.h */; };
-               7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */; };
                7E428CE513E3407F003B661C /* ResourceHandleIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */; };
                7E46F6FA1627A2CA00062223 /* JSOESElementIndexUint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */; };
                7E46F6FB1627A2CA00062223 /* JSOESElementIndexUint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E46F6F91627A2C900062223 /* JSOESElementIndexUint.h */; };
                7CFDC57B1AC1D80500E24A57 /* ContentExtensionError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionError.h; sourceTree = "<group>"; };
                7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchHeaders.cpp; sourceTree = "<group>"; };
                7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFetchHeaders.h; sourceTree = "<group>"; };
-               7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoaderCF.cpp; sourceTree = "<group>"; };
                7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleIOS.mm; sourceTree = "<group>"; };
                7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESElementIndexUint.cpp; sourceTree = "<group>"; };
                7E46F6F91627A2C900062223 /* JSOESElementIndexUint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESElementIndexUint.h; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                7EE6847412D26E7000E79415 /* ResourceLoaderCFNet.cpp */,
-                               7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */,
                        );
                        path = cf;
                        sourceTree = "<group>";
                                1FC40FB91655CCB60040F29E /* SubimageCacheWithTimer.cpp in Sources */,
                                F55B3DD31251F12D003EF269 /* SubmitInputType.cpp in Sources */,
                                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
-                               7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */,
                                7E8FADC4199A95B100714968 /* SubresourceLoaderCocoa.mm in Sources */,
                                5778BD841DA4817B009E3009 /* SubtleCrypto.cpp in Sources */,
                                93B2D8180F9920EE006AE6B2 /* SuddenTermination.mm in Sources */,
index b559d1a..fb81af0 100644 (file)
@@ -105,9 +105,6 @@ public:
     virtual void didReceiveBuffer(Ref<SharedBuffer>&&, long long encodedDataLength, DataPayloadType);
     virtual void didFinishLoading(const NetworkLoadMetrics&);
     virtual void didFail(const ResourceError&);
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    virtual void didReceiveDataArray(CFArrayRef dataArray);
-#endif
     virtual void didRetrieveDerivedDataFromCache(const String& type, SharedBuffer&);
 
     virtual bool shouldUseCredentialStorage();
@@ -196,9 +193,6 @@ private:
     void didFail(ResourceHandle*, const ResourceError&) override;
     void wasBlocked(ResourceHandle*) override;
     void cannotShowURL(ResourceHandle*) override;
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    void didReceiveDataArray(ResourceHandle*, CFArrayRef dataArray) override;
-#endif
     bool shouldUseCredentialStorage(ResourceHandle*) override { return shouldUseCredentialStorage(); }
     void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) override { didReceiveAuthenticationChallenge(challenge); } 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
index 74930e2..6e672a1 100644 (file)
@@ -83,10 +83,6 @@ private:
     CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
 #endif
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    bool supportsDataArray() override { return true; }
-    void didReceiveDataArray(CFArrayRef) override;
-#endif
     void releaseResources() override;
 
 #if USE(SOUP)
diff --git a/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp b/Source/WebCore/loader/cf/SubresourceLoaderCF.cpp
deleted file mode 100644 (file)
index 60b68eb..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "SubresourceLoader.h"
-
-#include "CachedResource.h"
-#include <wtf/Ref.h>
-
-namespace WebCore {
-
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-void SubresourceLoader::didReceiveDataArray(CFArrayRef dataArray)
-{
-    // Reference the object in this method since the additional processing can do anything including
-    // removing the last reference to this object; one example of this is <rdar://problem/3266216>.
-    Ref<SubresourceLoader> protectedThis(*this);
-
-    ResourceLoader::didReceiveDataArray(dataArray);
-
-    if (checkForHTTPStatusCodeError())
-        return;
-
-    // A subresource loader does not load multipart sections progressively.
-    // So don't deliver any data to the loader yet.
-    if (!m_loadingMultipartContent) {
-        CFIndex arrayCount = CFArrayGetCount(dataArray);
-        for (CFIndex i = 0; i < arrayCount; ++i)  {
-            // A previous iteration of this loop might have resulted in the load
-            // being cancelled. Bail out if we no longer have a cached resource.
-            if (!m_resource)
-                return;
-            if (auto* resourceData = this->resourceData())
-                m_resource->addDataBuffer(*resourceData);
-            else {
-                CFDataRef cfData = reinterpret_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, i));
-                const char* data = reinterpret_cast<const char *>(CFDataGetBytePtr(cfData));
-                CFIndex length = CFDataGetLength(cfData);
-                ASSERT(length <= std::numeric_limits<CFIndex>::max());
-                m_resource->addData(data, static_cast<unsigned>(length));
-            }
-        }
-    }
-}
-#endif
-
-}
index 99ead7b..25f00f2 100644 (file)
@@ -58,45 +58,4 @@ NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCached
 
 #endif
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-
-void ResourceLoader::didReceiveDataArray(CFArrayRef dataArray)
-{
-    // Protect this in this delegate method since the additional processing can do
-    // anything including possibly derefing this; one example of this is Radar 3266216.
-    Ref<ResourceLoader> protectedThis(*this);
-
-    CFIndex arrayCount = CFArrayGetCount(dataArray);
-    for (CFIndex i = 0; i < arrayCount; ++i) {
-        CFDataRef data = static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, i));
-        unsigned dataLen = static_cast<unsigned>(CFDataGetLength(data));
-
-        if (m_options.dataBufferingPolicy == BufferData) {
-            if (!m_resourceData)
-                m_resourceData = SharedBuffer::create();
-            m_resourceData->append(data);
-        }
-
-        // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
-        // However, with today's computers and networking speeds, this won't happen in practice.
-        // Could be an issue with a giant local file.
-        if (m_options.sendLoadCallbacks == SendCallbacks && m_frame)
-            frameLoader()->notifier().didReceiveData(this, reinterpret_cast<const char*>(CFDataGetBytePtr(data)), dataLen, dataLen);
-    }
-}
-
-void ResourceLoader::didReceiveDataArray(ResourceHandle*, CFArrayRef dataArray)
-{
-    CFIndex arrayCount = CFArrayGetCount(dataArray);
-    CFIndex dataLength = 0;
-    for (CFIndex i = 0; i < arrayCount; ++i) {
-        CFDataRef data = static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, i));
-        dataLength += CFDataGetLength(data);
-    }
-
-    didReceiveDataArray(dataArray);
-}
-
-#endif
-
 }
index 362c251..2618939 100644 (file)
@@ -42,90 +42,85 @@ OBJC_CLASS NSCachedURLResponse;
 #endif
 
 namespace WebCore {
-    class AuthenticationChallenge;
-    class Credential;
-    class URL;
-    class ProtectionSpace;
-    class ResourceHandle;
-    class ResourceError;
-    class ResourceRequest;
-    class ResourceResponse;
-    class SharedBuffer;
-
-    enum CacheStoragePolicy {
-        StorageAllowed,
-        StorageAllowedInMemoryOnly,
-        StorageNotAllowed
-    };
+class AuthenticationChallenge;
+class Credential;
+class URL;
+class ProtectionSpace;
+class ResourceHandle;
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+class SharedBuffer;
+
+enum CacheStoragePolicy {
+    StorageAllowed,
+    StorageAllowedInMemoryOnly,
+    StorageNotAllowed
+};
+
+class ResourceHandleClient {
+public:
+    WEBCORE_EXPORT ResourceHandleClient();
+    WEBCORE_EXPORT virtual ~ResourceHandleClient();
+
+    WEBCORE_EXPORT virtual ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);
+    virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
+
+    virtual void didReceiveResponse(ResourceHandle*, ResourceResponse&&) { }
     
-    class ResourceHandleClient {
-    public:
-        WEBCORE_EXPORT ResourceHandleClient();
-        WEBCORE_EXPORT virtual ~ResourceHandleClient();
-
-        WEBCORE_EXPORT virtual ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);
-        virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
-
-        virtual void didReceiveResponse(ResourceHandle*, ResourceResponse&&) { }
-        
-        virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) { }
-        WEBCORE_EXPORT virtual void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength);
-        
-        virtual void didFinishLoading(ResourceHandle*) { }
-        virtual void didFail(ResourceHandle*, const ResourceError&) { }
-        virtual void wasBlocked(ResourceHandle*) { }
-        virtual void cannotShowURL(ResourceHandle*) { }
+    virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) { }
+    WEBCORE_EXPORT virtual void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength);
+    
+    virtual void didFinishLoading(ResourceHandle*) { }
+    virtual void didFail(ResourceHandle*, const ResourceError&) { }
+    virtual void wasBlocked(ResourceHandle*) { }
+    virtual void cannotShowURL(ResourceHandle*) { }
 
-        virtual bool usesAsyncCallbacks() { return false; }
+    virtual bool usesAsyncCallbacks() { return false; }
 
-        virtual bool loadingSynchronousXHR() { return false; }
+    virtual bool loadingSynchronousXHR() { return false; }
 
-        // Client will pass an updated request using ResourceHandle::continueWillSendRequest() when ready.
-        WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);
+    // Client will pass an updated request using ResourceHandle::continueWillSendRequest() when ready.
+    WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);
 
-        // Client will call ResourceHandle::continueDidReceiveResponse() when ready.
-        WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&);
+    // Client will call ResourceHandle::continueDidReceiveResponse() when ready.
+    WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&);
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-        // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready.
-        WEBCORE_EXPORT virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&);
+    // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready.
+    WEBCORE_EXPORT virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&);
 #endif
-        // Client will pass an updated request using ResourceHandle::continueWillCacheResponse() when ready.
+    // Client will pass an updated request using ResourceHandle::continueWillCacheResponse() when ready.
 #if USE(CFURLCONNECTION)
-        WEBCORE_EXPORT virtual void willCacheResponseAsync(ResourceHandle*, CFCachedURLResponseRef);
+    WEBCORE_EXPORT virtual void willCacheResponseAsync(ResourceHandle*, CFCachedURLResponseRef);
 #elif PLATFORM(COCOA)
-        WEBCORE_EXPORT virtual void willCacheResponseAsync(ResourceHandle*, NSCachedURLResponse *);
-#endif
-
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-        virtual bool supportsDataArray() { return false; }
-        virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef) { }
+    WEBCORE_EXPORT virtual void willCacheResponseAsync(ResourceHandle*, NSCachedURLResponse *);
 #endif
 
 #if USE(SOUP)
-        virtual char* getOrCreateReadBuffer(size_t /*requestedLength*/, size_t& /*actualLength*/) { return 0; }
+    virtual char* getOrCreateReadBuffer(size_t /*requestedLength*/, size_t& /*actualLength*/) { return 0; }
 #endif
 
-        virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
-        virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
+    virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; }
+    virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-        virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; }
+    virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; }
 #endif
-        virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
+    virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
 
 #if PLATFORM(IOS) || USE(CFURLCONNECTION)
-        virtual RetainPtr<CFDictionaryRef> connectionProperties(ResourceHandle*) { return nullptr; }
+    virtual RetainPtr<CFDictionaryRef> connectionProperties(ResourceHandle*) { return nullptr; }
 #endif
 
 #if USE(CFURLCONNECTION)
-        virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef response) { return response; }
+    virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef response) { return response; }
 #if PLATFORM(WIN)
-        virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) { return true; }
+    virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) { return true; }
 #endif // PLATFORM(WIN)
 
 #elif PLATFORM(COCOA)
-        virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *response) { return response; }
+    virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *response) { return response; }
 #endif
-    };
+};
 
 }
index e250660..000e8f8 100644 (file)
@@ -121,13 +121,6 @@ Boolean ResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpaceCallba
 }
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-void ResourceHandleCFURLConnectionDelegate::didReceiveDataArrayCallback(CFURLConnectionRef, CFArrayRef dataArray, const void* clientInfo)
-{
-    static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->didReceiveDataArray(dataArray);
-}
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-
 RetainPtr<CFURLResponseRef> ResourceHandleCFURLConnectionDelegate::synthesizeRedirectResponseIfNecessary(CFURLRequestRef newRequest, CFURLResponseRef cfRedirectResponse)
 {
     if (cfRedirectResponse)
@@ -207,11 +200,7 @@ CFURLConnectionClient_V6 ResourceHandleCFURLConnectionDelegate::makeConnectionCl
         0,
 #endif
         0,
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-        &ResourceHandleCFURLConnectionDelegate::didReceiveDataArrayCallback
-#else
         0
-#endif
     };
     return client;
 }
index 46c4edf..4de70dc 100644 (file)
@@ -72,9 +72,6 @@ private:
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     static Boolean canRespondToProtectionSpaceCallback(CFURLConnectionRef, CFURLProtectionSpaceRef, const void* clientInfo);
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    static void didReceiveDataArrayCallback(CFURLConnectionRef, CFArrayRef, const void* clientInfo);
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
 
     virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) = 0;
     virtual void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) = 0;
@@ -88,9 +85,6 @@ private:
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     virtual Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) = 0;
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    virtual void didReceiveDataArray(CFArrayRef dataArray) = 0;
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
 
 protected:
     ResourceHandle* m_handle;
index 17fdc7f..de29de2 100644 (file)
@@ -303,24 +303,6 @@ Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToPro
 }
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray(CFArrayRef dataArray)
-{
-    // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(),
-    // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing.
-    RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protectedThis(this);
-    CFRetain(dataArray);
-    dispatch_async(dispatch_get_main_queue(), ^{
-        if (protectedThis->hasHandle() && m_handle->client()) {
-            LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
-
-            m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::wrapCFDataArray(dataArray), -1);
-        }
-        CFRelease(dataArray);
-    });
-}
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-
 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest(CFURLRequestRef request)
 {
     m_requestResult = request;
index f7788ea..bd84da3 100644 (file)
@@ -58,9 +58,6 @@ private:
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override;
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    void didReceiveDataArray(CFArrayRef dataArray) override;
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
 
     void continueWillSendRequest(CFURLRequestRef) override;
     void continueDidReceiveResponse() override;
index bec1b19..d1cd8e5 100644 (file)
@@ -272,19 +272,6 @@ Boolean SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtection
 }
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray(CFArrayRef dataArray)
-{
-    if (!m_handle->client())
-        return;
-
-    LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray(handle=%p, arrayLength=%ld) (%s)", m_handle, CFArrayGetCount(dataArray), m_handle->firstRequest().url().string().utf8().data());
-
-    if (ResourceHandleClient* client = m_handle->client())
-        client->didReceiveBuffer(m_handle, SharedBuffer::wrapCFDataArray(dataArray), -1);
-}
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-
 void SynchronousResourceHandleCFURLConnectionDelegate::continueWillSendRequest(CFURLRequestRef)
 {
     ASSERT_NOT_REACHED();
index 15138ee..c648932 100644 (file)
@@ -38,9 +38,6 @@ public:
     void didReceiveData(CFDataRef, CFIndex originalLength) override;
     void didFinishLoading() override;
     void didFail(CFErrorRef) override;
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    void didReceiveDataArray(CFArrayRef dataArray) override;
-#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
 
 private:
     void setupRequest(CFMutableURLRequestRef) override;
index f0ec325..c825a29 100644 (file)
@@ -153,23 +153,6 @@ using namespace WebCore;
     m_handle->didReceiveResponse(WTFMove(resourceResponse));
 }
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
-{
-    UNUSED_PARAM(connection);
-    LOG(Network, "Handle %p delegate connection:%p didReceiveDataArray:%p arraySize:%d", m_handle, connection, dataArray, [dataArray count]);
-
-    if (!dataArray)
-        return;
-
-    if (!m_handle || !m_handle->client())
-        return;
-
-    m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::wrapCFDataArray(reinterpret_cast<CFArrayRef>(dataArray)), -1);
-    // The call to didReceiveData above can cancel a load, and if so, the delegate (self) could have been deallocated by this point.
-}
-#endif
-
 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
 {
     UNUSED_PARAM(connection);
index 2c93a4b..631f4be 100644 (file)
@@ -205,27 +205,6 @@ using namespace WebCore;
     dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
 }
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
-{
-    ASSERT(!isMainThread());
-    UNUSED_PARAM(connection);
-
-    LOG(Network, "Handle %p delegate connection:%p didReceiveDataArray:%p arraySize:%d", m_handle, connection, dataArray, [dataArray count]);
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        if (!dataArray)
-            return;
-
-        if (!m_handle || !m_handle->client())
-            return;
-
-        m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::wrapCFDataArray(reinterpret_cast<CFArrayRef>(dataArray)), -1);
-        // The call to didReceiveData above can cancel a load, and if so, the delegate (self) could have been deallocated by this point.
-    });
-}
-#endif
-
 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
 {
     ASSERT(!isMainThread());
index 4f1877a..8b9135d 100644 (file)
@@ -1,3 +1,15 @@
+2017-04-12  Alex Christensen  <achristensen@webkit.org>
+
+        Stop using didReceiveDataArray callback on El Capitan
+        https://bugs.webkit.org/show_bug.cgi?id=170780
+
+        Reviewed by Brady Eidson.
+
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::supportsDataArray): Deleted.
+        (WebKit::NetworkLoad::didReceiveDataArray): Deleted.
+        * NetworkProcess/NetworkLoad.h:
+
 2017-04-12  Beth Dakin  <bdakin@apple.com>
 
         Speculative build fix.
index 1b0a637..b7dfd31 100644 (file)
@@ -524,20 +524,6 @@ void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result)
 }
 #endif
 
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-bool NetworkLoad::supportsDataArray()
-{
-    notImplemented();
-    return false;
-}
-
-void NetworkLoad::didReceiveDataArray(ResourceHandle*, CFArrayRef)
-{
-    ASSERT_NOT_REACHED();
-    notImplemented();
-}
-#endif
-
 void NetworkLoad::didSendData(ResourceHandle* handle, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 {
     ASSERT_UNUSED(handle, handle == m_handle);
index ca261d5..62873e4 100644 (file)
@@ -84,10 +84,6 @@ public:
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     void canAuthenticateAgainstProtectionSpaceAsync(WebCore::ResourceHandle*, const WebCore::ProtectionSpace&) override;
 #endif
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    bool supportsDataArray() override;
-    void didReceiveDataArray(WebCore::ResourceHandle*, CFArrayRef) override;
-#endif
 #if PLATFORM(COCOA)
 #if USE(CFURLCONNECTION)
     void willCacheResponseAsync(WebCore::ResourceHandle*, CFCachedURLResponseRef) override;