[QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jan 2017 21:00:30 +0000 (21:00 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jan 2017 21:00:30 +0000 (21:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166713

Reviewed by Alex Christensen.

Source/WebCore:

QuickLook conversion was originally implemented by intercepting document loads at the
ResourceHandle level, with separate paths for NSURLConnection and CFURLConnection handles.
When QuickLook was ported to WebKit2, a third path was added in WebResourceLoader.

This change removes these three separate paths and implements a single conversion path in
SubresourceLoader, where QuickLook can intercept document loads regardless of the networking
API being used.

No change in behavior. Covered by existing tests.

* loader/ResourceLoader.h: Removed override from didCreateQuickLookHandle() since this
function is no longer declared in ResourceHandleClient.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Added a helper
function to check if a QuickLookHandle should be created for a response.
(WebCore::SubresourceLoader::didReceiveResponse): Created a QuickLookHandle if necessary
and stored it in the DocumentLoader.
(WebCore::SubresourceLoader::didReceiveData): If there is a QuickLookHandle, call
QuickLookHandle::didReceiveBuffer(), and return early if QuickLook is converting.
(WebCore::SubresourceLoader::didReceiveBuffer): Ditto for QuickLookHandle::didReceiveBuffer().
(WebCore::SubresourceLoader::didFinishLoading): Ditto for QuickLookHandle::didFinishLoading().
(WebCore::SubresourceLoader::didFail): If there is a QuickLookHandle, call QuickLookHandle::didFail().
* loader/SubresourceLoader.h: Declared shouldCreateQuickLookHandleForResponse().
* loader/ios/QuickLook.h: Removed declarations used by the ResourceHandles and declared new
functions used by SubresourceLoader.
* loader/ios/QuickLook.mm:
(WebCore::QuickLookHandle::QuickLookHandle): Removed the NSURLConnection * parameter, since
we’d now always pass nil.
(WebCore::QuickLookHandle::create): Removed create() functions used by ResourceHandles.
(WebCore::QuickLookHandle::didReceiveData): Added. Copies the data into an NSData, wraps it
in an NSArray, and passes it to didReceiveDataArray().
(WebCore::QuickLookHandle::didReceiveBuffer): Added. Creates a NSArray of NSData from the
SharedBuffer and passes it to didReceiveDataArray().
(-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
(-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
(-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
(-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
(-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
(-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
(WebCore::QuickLookHandle::cfResponse): Deleted.
(WebCore::QuickLookHandle::didReceiveDataArray): Passed dataArray to m_converter and m_client.
* platform/SharedBuffer.h: Const-qualified createNSDataArray().
* platform/cocoa/SharedBufferCocoa.mm:
(WebCore::SharedBuffer::createNSDataArray): Ditto.
* platform/network/ResourceHandle.cpp: Stopped including QuickLook.h.
* platform/network/ResourceHandle.h: Removed m_quickLook.
(WebCore::ResourceHandle::quickLookHandle): Deleted.
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::didCreateQuickLookHandle): Deleted.
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Removed QuickLook code.
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData): Ditto.
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading): Ditto.
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFail): Ditto.
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Ditto.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::setQuickLookHandle): Deleted.
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Removed QuickLook code.
(-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Ditto.
(-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]): Ditto.
(-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
(-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.

Source/WebKit2:

* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResponse): Removed QuickLook code.
(WebKit::WebResourceLoader::didReceiveData): Ditto.
(WebKit::WebResourceLoader::didFinishResourceLoad): Ditto.
(WebKit::WebResourceLoader::didFailResourceLoad): Ditto.
(WebKit::WebResourceLoader::didReceiveResource): Ditto.

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/ios/QuickLook.h
Source/WebCore/loader/ios/QuickLook.mm
Source/WebCore/platform/SharedBuffer.h
Source/WebCore/platform/cocoa/SharedBufferCocoa.mm
Source/WebCore/platform/network/ResourceHandle.cpp
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp

index db6e1ce..f11a11d 100644 (file)
@@ -1,3 +1,74 @@
+2017-01-07  Andy Estes  <aestes@apple.com>
+
+        [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
+        https://bugs.webkit.org/show_bug.cgi?id=166713
+
+        Reviewed by Alex Christensen.
+
+        QuickLook conversion was originally implemented by intercepting document loads at the
+        ResourceHandle level, with separate paths for NSURLConnection and CFURLConnection handles.
+        When QuickLook was ported to WebKit2, a third path was added in WebResourceLoader.
+        
+        This change removes these three separate paths and implements a single conversion path in
+        SubresourceLoader, where QuickLook can intercept document loads regardless of the networking
+        API being used.
+
+        No change in behavior. Covered by existing tests.
+
+        * loader/ResourceLoader.h: Removed override from didCreateQuickLookHandle() since this
+        function is no longer declared in ResourceHandleClient.
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Added a helper
+        function to check if a QuickLookHandle should be created for a response.
+        (WebCore::SubresourceLoader::didReceiveResponse): Created a QuickLookHandle if necessary
+        and stored it in the DocumentLoader.
+        (WebCore::SubresourceLoader::didReceiveData): If there is a QuickLookHandle, call
+        QuickLookHandle::didReceiveBuffer(), and return early if QuickLook is converting.
+        (WebCore::SubresourceLoader::didReceiveBuffer): Ditto for QuickLookHandle::didReceiveBuffer().
+        (WebCore::SubresourceLoader::didFinishLoading): Ditto for QuickLookHandle::didFinishLoading().
+        (WebCore::SubresourceLoader::didFail): If there is a QuickLookHandle, call QuickLookHandle::didFail().
+        * loader/SubresourceLoader.h: Declared shouldCreateQuickLookHandleForResponse().
+        * loader/ios/QuickLook.h: Removed declarations used by the ResourceHandles and declared new
+        functions used by SubresourceLoader.
+        * loader/ios/QuickLook.mm:
+        (WebCore::QuickLookHandle::QuickLookHandle): Removed the NSURLConnection * parameter, since
+        we’d now always pass nil.
+        (WebCore::QuickLookHandle::create): Removed create() functions used by ResourceHandles.
+        (WebCore::QuickLookHandle::didReceiveData): Added. Copies the data into an NSData, wraps it
+        in an NSArray, and passes it to didReceiveDataArray().
+        (WebCore::QuickLookHandle::didReceiveBuffer): Added. Creates a NSArray of NSData from the
+        SharedBuffer and passes it to didReceiveDataArray().
+        (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
+        (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
+        (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
+        (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
+        (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
+        (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
+        (WebCore::QuickLookHandle::cfResponse): Deleted.
+        (WebCore::QuickLookHandle::didReceiveDataArray): Passed dataArray to m_converter and m_client.
+        * platform/SharedBuffer.h: Const-qualified createNSDataArray().
+        * platform/cocoa/SharedBufferCocoa.mm:
+        (WebCore::SharedBuffer::createNSDataArray): Ditto.
+        * platform/network/ResourceHandle.cpp: Stopped including QuickLook.h.
+        * platform/network/ResourceHandle.h: Removed m_quickLook.
+        (WebCore::ResourceHandle::quickLookHandle): Deleted.
+        * platform/network/ResourceHandleClient.h:
+        (WebCore::ResourceHandleClient::didCreateQuickLookHandle): Deleted.
+        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Removed QuickLook code.
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData): Ditto.
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading): Ditto.
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFail): Ditto.
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Ditto.
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::setQuickLookHandle): Deleted.
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Removed QuickLook code.
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
+        (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.
+
 2017-01-06  Daniel Bates  <dabates@apple.com>
 
         Ensure navigation only allowed for documents not in the page cache
index 8c98d12..45d6e24 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,11 +50,8 @@ class AuthenticationChallenge;
 class DocumentLoader;
 class Frame;
 class FrameLoader;
-class URL;
-
-#if USE(QUICK_LOOK)
 class QuickLookHandle;
-#endif
+class URL;
 
 class ResourceLoader : public RefCounted<ResourceLoader>, protected ResourceHandleClient {
 public:
@@ -119,7 +116,7 @@ public:
     virtual void receivedCancellation(const AuthenticationChallenge&);
 
 #if USE(QUICK_LOOK)
-    void didCreateQuickLookHandle(QuickLookHandle&) override;
+    void didCreateQuickLookHandle(QuickLookHandle&);
 #endif
     bool isQuickLookResource() { return m_isQuickLookResource; }
 
index ca0bc00..7689d78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2007, 2009, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "ResourceLoadInfo.h"
 #endif
 
+#if USE(QUICK_LOOK)
+#include "QuickLook.h"
+#endif
+
 namespace WebCore {
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, subresourceLoaderCounter, ("SubresourceLoader"));
@@ -247,11 +251,31 @@ void SubresourceLoader::didSendData(unsigned long long bytesSent, unsigned long
     m_resource->didSendData(bytesSent, totalBytesToBeSent);
 }
 
+#if USE(QUICK_LOOK)
+bool SubresourceLoader::shouldCreateQuickLookHandleForResponse(const ResourceResponse& response) const
+{
+    if (m_resource->type() != CachedResource::MainResource)
+        return false;
+
+    if (m_documentLoader->quickLookHandle())
+        return false;
+
+    return QuickLookHandle::shouldCreateForMIMEType(response.mimeType());
+}
+#endif
+
 void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
 {
     ASSERT(!response.isNull());
     ASSERT(m_state == Initialized);
 
+#if USE(QUICK_LOOK)
+    if (shouldCreateQuickLookHandleForResponse(response)) {
+        m_documentLoader->setQuickLookHandle(QuickLookHandle::create(*this, response));
+        return;
+    }
+#endif
+
     // We want redirect responses to be processed through willSendRequestInternal. The only exception is redirection with no Location headers.
     ASSERT(response.httpStatusCode() < 300 || response.httpStatusCode() >= 400 || response.httpStatusCode() == 304 || !response.httpHeaderField(HTTPHeaderName::Location));
 
@@ -325,11 +349,25 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
 
 void SubresourceLoader::didReceiveData(const char* data, unsigned length, long long encodedDataLength, DataPayloadType dataPayloadType)
 {
+#if USE(QUICK_LOOK)
+    if (auto quickLookHandle = m_documentLoader->quickLookHandle()) {
+        if (quickLookHandle->didReceiveData(data, length))
+            return;
+    }
+#endif
+
     didReceiveDataOrBuffer(data, length, nullptr, encodedDataLength, dataPayloadType);
 }
 
 void SubresourceLoader::didReceiveBuffer(Ref<SharedBuffer>&& buffer, long long encodedDataLength, DataPayloadType dataPayloadType)
 {
+#if USE(QUICK_LOOK)
+    if (auto quickLookHandle = m_documentLoader->quickLookHandle()) {
+        if (quickLookHandle->didReceiveBuffer(buffer.get()))
+            return;
+    }
+#endif
+
     didReceiveDataOrBuffer(nullptr, 0, WTFMove(buffer), encodedDataLength, dataPayloadType);
 }
 
@@ -468,6 +506,13 @@ bool SubresourceLoader::checkRedirectionCrossOriginAccessControl(const ResourceR
 
 void SubresourceLoader::didFinishLoading(double finishTime)
 {
+#if USE(QUICK_LOOK)
+    if (auto quickLookHandle = m_documentLoader->quickLookHandle()) {
+        if (quickLookHandle->didFinishLoading())
+            return;
+    }
+#endif
+
     if (m_state != Initialized)
         return;
     ASSERT(!reachedTerminalState());
@@ -510,6 +555,11 @@ void SubresourceLoader::didFinishLoading(double finishTime)
 
 void SubresourceLoader::didFail(const ResourceError& error)
 {
+#if USE(QUICK_LOOK)
+    if (auto quickLookHandle = m_documentLoader->quickLookHandle())
+        quickLookHandle->didFail();
+#endif
+
     if (m_state != Initialized)
         return;
     ASSERT(!reachedTerminalState());
index 84c0ac4..f6ea66e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -101,6 +101,10 @@ private:
 
     void notifyDone();
 
+#if USE(QUICK_LOOK)
+    bool shouldCreateQuickLookHandleForResponse(const ResourceResponse&) const;
+#endif
+
     enum SubresourceLoaderState {
         Uninitialized,
         Initialized,
index 4da045b..553ced5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <wtf/RefPtr.h>
 #include <wtf/RetainPtr.h>
 
+OBJC_CLASS NSArray;
 OBJC_CLASS NSData;
 OBJC_CLASS NSDictionary;
 OBJC_CLASS NSFileHandle;
 OBJC_CLASS NSSet;
 OBJC_CLASS NSString;
 OBJC_CLASS NSURL;
-OBJC_CLASS NSURLConnection;
 OBJC_CLASS NSURLRequest;
 OBJC_CLASS NSURLResponse;
 OBJC_CLASS QLPreviewConverter;
 
 namespace WebCore {
 
-class ResourceHandle;
 class ResourceLoader;
 class ResourceResponse;
-class SynchronousResourceHandleCFURLConnectionDelegate;
+class SharedBuffer;
 class URL;
 
 WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
@@ -74,26 +73,16 @@ WEBCORE_EXPORT NSString *createTemporaryFileForQuickLook(NSString *fileName);
 class QuickLookHandle {
     WTF_MAKE_NONCOPYABLE(QuickLookHandle);
 public:
-    WEBCORE_EXPORT static bool shouldCreateForMIMEType(const String&);
+    static bool shouldCreateForMIMEType(const String&);
+    static std::unique_ptr<QuickLookHandle> create(ResourceLoader&, const ResourceResponse&);
+    ~QuickLookHandle();
 
-    static std::unique_ptr<QuickLookHandle> create(ResourceHandle*, NSURLConnection *, NSURLResponse *, id delegate);
-#if USE(CFURLCONNECTION)
-    static std::unique_ptr<QuickLookHandle> create(ResourceHandle*, SynchronousResourceHandleCFURLConnectionDelegate*, CFURLResponseRef);
-#endif
-    // FIXME: Use of ResourceLoader here is a platform violation.
-    WEBCORE_EXPORT static std::unique_ptr<QuickLookHandle> create(ResourceLoader&, const ResourceResponse&);
-
-    WEBCORE_EXPORT ~QuickLookHandle();
-
-    WEBCORE_EXPORT bool didReceiveDataArray(CFArrayRef);
-    WEBCORE_EXPORT bool didReceiveData(CFDataRef);
-    WEBCORE_EXPORT bool didFinishLoading();
-    WEBCORE_EXPORT void didFail();
+    bool didReceiveData(const char* data, unsigned length);
+    bool didReceiveBuffer(const SharedBuffer&);
+    bool didFinishLoading();
+    void didFail();
 
     WEBCORE_EXPORT NSURLResponse *nsResponse();
-#if USE(CFURLCONNECTION)
-    CFURLResponseRef cfResponse();
-#endif
 
     void setClient(PassRefPtr<QuickLookHandleClient> client) { m_client = client; }
 
@@ -104,7 +93,9 @@ public:
     QLPreviewConverter *converter() const { return m_converter.get(); }
 
 private:
-    QuickLookHandle(NSURL *, NSURLConnection *, NSURLResponse *, id delegate);
+    QuickLookHandle(NSURL *, NSURLResponse *, id delegate);
+
+    void didReceiveDataArray(NSArray *);
 
     RetainPtr<NSURL> m_firstRequestURL;
     RetainPtr<QLPreviewConverter> m_converter;
index eadf3dd..d142147 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #if USE(QUICK_LOOK)
 
-#import "DocumentLoader.h"
 #import "FileSystemIOS.h"
 #import "Logging.h"
 #import "NSFileManagerSPI.h"
 #import "ResourceError.h"
-#import "ResourceHandle.h"
 #import "ResourceLoader.h"
-#import "RuntimeApplicationChecks.h"
-#import "SynchronousResourceHandleCFURLConnectionDelegate.h"
+#import "SharedBuffer.h"
 #import "WebCoreResourceHandleAsDelegate.h"
-#import "WebCoreURLResponseIOS.h"
 #import <Foundation/Foundation.h>
 #import <wtf/NeverDestroyed.h>
-#import <wtf/StdLibExtras.h>
-#import <wtf/Threading.h>
 #import <wtf/Vector.h>
 #import <wtf/text/WTFString.h>
 
@@ -185,81 +179,6 @@ const char* WebCore::QLPreviewProtocol()
     return previewProtocol.get().data();
 }
 
-#if USE(CFURLCONNECTION)
-// The way QuickLook works is we pass it an NSURLConnectionDelegate callback object at creation
-// time. Then we pass it all the data as we receive it. Once we've downloaded the full URL,
-// QuickLook turns around and send us, through this delegate, the HTML version of the file which we
-// pass on to WebCore. The flag m_finishedLoadingDataIntoConverter in QuickLookHandle decides
-// whether to pass the data to QuickLook or WebCore.
-//
-// This works fine when using NS APIs, but when using CFNetwork, we don't have a NSURLConnectionDelegate.
-// So we create WebQuickLookHandleAsDelegate as an intermediate delegate object and pass it to
-// QLPreviewConverter. The proxy delegate then forwards the messages on to the CFNetwork code.
-@interface WebQuickLookHandleAsDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
-    RefPtr<SynchronousResourceHandleCFURLConnectionDelegate> m_connectionDelegate;
-}
-
-- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate;
-@end
-
-@implementation WebQuickLookHandleAsDelegate
-- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate
-{
-    self = [super init];
-    if (!self)
-        return nil;
-    m_connectionDelegate = connectionDelegate;
-    return self;
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, "WebQuickLookHandleAsDelegate::didReceiveDataArray()");
-    m_connectionDelegate->didReceiveDataArray(reinterpret_cast<CFArrayRef>(dataArray));
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, "WebQuickLookHandleAsDelegate::didReceiveData() - data length = %ld", (long)[data length]);
-
-    // QuickLook code sends us a nil data at times. The check below is the same as the one in
-    // ResourceHandleMac.cpp added for a different bug.
-    if (![data length])
-        return;
-    m_connectionDelegate->didReceiveData(reinterpret_cast<CFDataRef>(data), static_cast<int>(lengthReceived));
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, "WebQuickLookHandleAsDelegate::didFinishLoading()");
-    m_connectionDelegate->didFinishLoading();
-}
-
-- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
-{
-    UNUSED_PARAM(connection);
-    if (!m_connectionDelegate)
-        return;
-    LOG(Network, "WebQuickLookHandleAsDelegate::didFail()");
-    m_connectionDelegate->didFail(reinterpret_cast<CFErrorRef>(error));
-}
-
-- (void)detachHandle
-{
-    m_connectionDelegate = nullptr;
-}
-@end
-#endif
-
 @interface WebResourceLoaderQuickLookDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     RefPtr<ResourceLoader> _resourceLoader;
     BOOL _hasSentDidReceiveResponse;
@@ -392,9 +311,9 @@ static inline QuickLookHandleClient* emptyClient()
     return &emptyClient.get();
 }
 
-QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
+QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLResponse *nsResponse, id delegate)
     : m_firstRequestURL(firstRequestURL)
-    , m_converter(adoptNS([allocQLPreviewConverterInstance() initWithConnection:connection delegate:delegate response:nsResponse options:nil]))
+    , m_converter(adoptNS([allocQLPreviewConverterInstance() initWithConnection:nil delegate:delegate response:nsResponse options:nil]))
     , m_delegate(delegate)
     , m_finishedLoadingDataIntoConverter(false)
     , m_nsResponse([m_converter previewResponse])
@@ -403,37 +322,6 @@ QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLConnection *connec
     LOG(Network, "QuickLookHandle::QuickLookHandle() - previewFileName: %s", [m_converter previewFileName]);
 }
 
-std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
-{
-    ASSERT_ARG(handle, handle);
-    if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
-        return nullptr;
-
-    std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([handle->firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], connection, nsResponse, delegate));
-    handle->client()->didCreateQuickLookHandle(*quickLookHandle);
-    return quickLookHandle;
-}
-
-#if USE(CFURLCONNECTION)
-std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
-{
-    ASSERT_ARG(handle, handle);
-    if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
-        return nullptr;
-
-    NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
-    WebQuickLookHandleAsDelegate *delegate = [[[WebQuickLookHandleAsDelegate alloc] initWithConnectionDelegate:connectionDelegate] autorelease];
-    std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([handle->firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, nsResponse, delegate));
-    handle->client()->didCreateQuickLookHandle(*quickLookHandle);
-    return quickLookHandle;
-}
-
-CFURLResponseRef QuickLookHandle::cfResponse()
-{
-    return [m_nsResponse _CFURLResponse];
-}
-#endif
-
 bool QuickLookHandle::shouldCreateForMIMEType(const String& mimeType)
 {
     return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
@@ -444,7 +332,7 @@ std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceLoader& loader,
     ASSERT(shouldCreateForMIMEType(response.mimeType()));
 
     RetainPtr<WebResourceLoaderQuickLookDelegate> delegate = adoptNS([[WebResourceLoaderQuickLookDelegate alloc] initWithResourceLoader:&loader]);
-    std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([loader.originalRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, response.nsURLResponse(), delegate.get()));
+    std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([loader.originalRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], response.nsURLResponse(), delegate.get()));
     [delegate setQuickLookHandle:quickLookHandle.get()];
     loader.didCreateQuickLookHandle(*quickLookHandle);
     return quickLookHandle;
@@ -455,23 +343,30 @@ NSURLResponse *QuickLookHandle::nsResponse()
     return m_nsResponse.get();
 }
 
-bool QuickLookHandle::didReceiveDataArray(CFArrayRef cfDataArray)
+bool QuickLookHandle::didReceiveData(const char* data, unsigned length)
 {
     if (m_finishedLoadingDataIntoConverter)
         return false;
 
-    LOG(Network, "QuickLookHandle::didReceiveDataArray()");
-    [m_converter appendDataArray:(NSArray *)cfDataArray];
-    m_client->didReceiveDataArray(cfDataArray);
+    didReceiveDataArray(@[ [NSData dataWithBytes:data length:length] ]);
     return true;
 }
 
-bool QuickLookHandle::didReceiveData(CFDataRef cfData)
+bool QuickLookHandle::didReceiveBuffer(const SharedBuffer& buffer)
 {
     if (m_finishedLoadingDataIntoConverter)
         return false;
-    
-    return didReceiveDataArray(adoptCF(CFArrayCreate(kCFAllocatorDefault, (const void**)&cfData, 1, &kCFTypeArrayCallBacks)).get());
+
+    didReceiveDataArray(buffer.createNSDataArray().get());
+    return true;
+}
+
+void QuickLookHandle::didReceiveDataArray(NSArray *dataArray)
+{
+    ASSERT(!m_finishedLoadingDataIntoConverter);
+    LOG(Network, "QuickLookHandle::didReceiveDataArray()");
+    [m_converter appendDataArray:dataArray];
+    m_client->didReceiveDataArray((CFArrayRef)dataArray);
 }
 
 bool QuickLookHandle::didFinishLoading()
index 83a4638..cdc21bc 100644 (file)
@@ -65,7 +65,7 @@ public:
     
 #if USE(FOUNDATION)
     WEBCORE_EXPORT RetainPtr<NSData> createNSData();
-    WEBCORE_EXPORT RetainPtr<NSArray> createNSDataArray();
+    WEBCORE_EXPORT RetainPtr<NSArray> createNSDataArray() const;
     WEBCORE_EXPORT static Ref<SharedBuffer> wrapNSData(NSData *);
 #endif
 #if USE(CF)
index 4a269ef..70be9e3 100644 (file)
@@ -123,7 +123,7 @@ RefPtr<SharedBuffer> SharedBuffer::createFromReadingFile(const String& filePath)
     return nullptr;
 }
 
-RetainPtr<NSArray> SharedBuffer::createNSDataArray()
+RetainPtr<NSArray> SharedBuffer::createNSDataArray() const
 {
     if (auto platformData = (NSData *)m_cfData.get())
         return @[ platformData ];
index 21b3295..1fd0fd9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <wtf/text/AtomicStringHash.h>
 #include <wtf/text/CString.h>
 
-#if USE(QUICK_LOOK)
-#include "QuickLook.h"
-#endif
-
 namespace WebCore {
 
 static bool shouldForceContentSniffing;
index 7bfaa33..380c320 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2011, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -147,11 +147,6 @@ public:
     static void setClientCertificate(const String& host, CFDataRef);
 #endif
 
-#if USE(QUICK_LOOK)
-    QuickLookHandle* quickLookHandle() { return m_quickLook.get(); }
-    void setQuickLookHandle(std::unique_ptr<QuickLookHandle>);
-#endif
-
 #if PLATFORM(WIN) && USE(CURL)
     static void setHostAllowsAnyHTTPSCertificate(const String&);
     static void setClientCertificateInfo(const String&, const String&, const String&);
@@ -280,10 +275,6 @@ private:
 
     friend class ResourceHandleInternal;
     std::unique_ptr<ResourceHandleInternal> d;
-
-#if USE(QUICK_LOOK)
-    std::unique_ptr<QuickLookHandle> m_quickLook;
-#endif
 };
 
 }
index a515ba3..5c371ed 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Inc.  All rights reserved.
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,10 +52,6 @@ namespace WebCore {
     class ResourceResponse;
     class SharedBuffer;
 
-#if USE(QUICK_LOOK)
-    class QuickLookHandle;
-#endif
-
     enum CacheStoragePolicy {
         StorageAllowed,
         StorageAllowedInMemoryOnly,
@@ -131,10 +126,6 @@ namespace WebCore {
 #elif PLATFORM(COCOA)
         virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *response) { return response; }
 #endif
-
-#if USE(QUICK_LOOK)
-        virtual void didCreateQuickLookHandle(QuickLookHandle&) { }
-#endif
     };
 
 }
index 0d7c708..84e2f15 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004-2013, 2015 Apple Inc.  All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -167,15 +167,6 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLC
     }
 #endif
 
-#if USE(QUICK_LOOK)
-    bool isQuickLookPreview = false;
-    m_handle->setQuickLookHandle(QuickLookHandle::create(m_handle, this, cfResponse));
-    if (m_handle->quickLookHandle()) {
-        cfResponse = m_handle->quickLookHandle()->cfResponse();
-        isQuickLookPreview = true;
-    }
-#endif
-
     ResourceResponse resourceResponse(cfResponse);
 #if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
     ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
@@ -183,10 +174,6 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLC
     UNUSED_PARAM(connection);
 #endif
 
-#if USE(QUICK_LOOK)
-    resourceResponse.setIsQuickLook(isQuickLookPreview);
-#endif
-
     m_handle->client()->didReceiveResponse(m_handle, WTFMove(resourceResponse));
 }
 
@@ -194,11 +181,6 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData(CFDataRef
 {
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData(handle=%p, bytes=%ld) (%s)", m_handle, CFDataGetLength(data), m_handle->firstRequest().url().string().utf8().data());
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle() && m_handle->quickLookHandle()->didReceiveData(data))
-        return;
-#endif
-
     if (ResourceHandleClient* client = m_handle->client())
         client->didReceiveBuffer(m_handle, SharedBuffer::wrapCFData(data), originalLength);
 }
@@ -207,11 +189,6 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading()
 {
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle() && m_handle->quickLookHandle()->didFinishLoading())
-        return;
-#endif
-
     if (ResourceHandleClient* client = m_handle->client())
         client->didFinishLoading(m_handle, 0);
 }
@@ -220,11 +197,6 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didFail(CFErrorRef error)
 {
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didFail(handle=%p, error = %p) (%s)", m_handle, error, m_handle->firstRequest().url().string().utf8().data());
 
-#if USE(QUICK_LOOK)
-    if (QuickLookHandle* quickLookHandle = m_handle->quickLookHandle())
-        quickLookHandle->didFail();
-#endif
-
     if (ResourceHandleClient* client = m_handle->client())
         client->didFail(m_handle, ResourceError(error));
 }
@@ -306,11 +278,6 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray(CFArr
 
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray(handle=%p, arrayLength=%ld) (%s)", m_handle, CFArrayGetCount(dataArray), m_handle->firstRequest().url().string().utf8().data());
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle() && m_handle->quickLookHandle()->didReceiveDataArray(dataArray))
-        return;
-#endif
-
     if (ResourceHandleClient* client = m_handle->client())
         client->didReceiveBuffer(m_handle, SharedBuffer::wrapCFDataArray(dataArray), -1);
 }
index 1737c78..5ba278d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -77,10 +77,6 @@ CFDictionaryRef _CFURLConnectionCopyTimingData(CFURLConnectionRef);
 @end
 #endif
 
-#if USE(QUICK_LOOK)
-#import "QuickLook.h"
-#endif
-
 using namespace WebCore;
 
 @interface NSURLConnection ()
@@ -752,12 +748,5 @@ void ResourceHandle::getConnectionTimingData(NSURLConnection *connection, Networ
     
 #endif // ENABLE(WEB_TIMING)
 
-#if USE(QUICK_LOOK)
-void ResourceHandle::setQuickLookHandle(std::unique_ptr<QuickLookHandle> handle)
-{
-    m_quickLook = WTFMove(handle);
-}
-#endif
-
 } // namespace WebCore
 
index 8a09f1e..fc1f4f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #import "SharedBuffer.h"
 #import "WebCoreURLResponse.h"
 
-#if USE(QUICK_LOOK)
-#import "QuickLook.h"
-#endif
-
 using namespace WebCore;
 
 @implementation WebCoreResourceHandleAsDelegate
@@ -146,20 +142,8 @@ using namespace WebCore;
         [response _setMIMEType:@"text/html"];
 #endif
 
-#if USE(QUICK_LOOK)
-    bool isQuickLookPreview = false;
-    m_handle->setQuickLookHandle(QuickLookHandle::create(m_handle, connection, response, self));
-    if (m_handle->quickLookHandle()) {
-        response = m_handle->quickLookHandle()->nsResponse();
-        isQuickLookPreview = true;
-    }
-#endif
-
     ResourceResponse resourceResponse(response);
     resourceResponse.setSource(ResourceResponse::Source::Network);
-#if USE(QUICK_LOOK)
-    resourceResponse.setIsQuickLook(isQuickLookPreview);
-#endif
 #if ENABLE(WEB_TIMING)
     ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
 #else
@@ -181,11 +165,6 @@ using namespace WebCore;
     if (!m_handle || !m_handle->client())
         return;
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle() && m_handle->quickLookHandle()->didReceiveDataArray(reinterpret_cast<CFArrayRef>(dataArray)))
-        return;
-#endif
-
     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.
 }
@@ -209,11 +188,6 @@ using namespace WebCore;
     // However, with today's computers and networking speeds, this won't happen in practice.
     // Could be an issue with a giant local file.
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle() && m_handle->quickLookHandle()->didReceiveData(reinterpret_cast<CFDataRef>(data)))
-        return;
-#endif
-
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=19793
     // -1 means we do not provide any data about transfer size to inspector so it would use
     // Content-Length headers or content size to show transfer size.
@@ -241,11 +215,6 @@ using namespace WebCore;
     if (!m_handle || !m_handle->client())
         return;
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle() && m_handle->quickLookHandle()->didFinishLoading())
-        return;
-#endif
-
     m_handle->client()->didFinishLoading(m_handle, 0);
 }
 
@@ -258,11 +227,6 @@ using namespace WebCore;
     if (!m_handle || !m_handle->client())
         return;
 
-#if USE(QUICK_LOOK)
-    if (m_handle->quickLookHandle())
-        m_handle->quickLookHandle()->didFail();
-#endif
-
     m_handle->client()->didFail(m_handle, error);
 }
 
index 1f44d74..d177a99 100644 (file)
@@ -1,3 +1,17 @@
+2017-01-07  Andy Estes  <aestes@apple.com>
+
+        [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
+        https://bugs.webkit.org/show_bug.cgi?id=166713
+
+        Reviewed by Alex Christensen.
+
+        * WebProcess/Network/WebResourceLoader.cpp:
+        (WebKit::WebResourceLoader::didReceiveResponse): Removed QuickLook code.
+        (WebKit::WebResourceLoader::didReceiveData): Ditto.
+        (WebKit::WebResourceLoader::didFinishResourceLoad): Ditto.
+        (WebKit::WebResourceLoader::didFailResourceLoad): Ditto.
+        (WebKit::WebResourceLoader::didReceiveResource): Ditto.
+
 2017-01-06  Daniel Bates  <dabates@apple.com>
 
         Attempt to fix the EFL build following <http://trac.webkit.org/changeset/210461>
index 6b80266..738b1dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <WebCore/ResourceLoader.h>
 #include <WebCore/SubresourceLoader.h>
 
-#if USE(QUICK_LOOK)
-#include <WebCore/QuickLook.h>
-#endif
-
 using namespace WebCore;
 
 #define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - WebResourceLoader::" fmt, this, ##__VA_ARGS__)
@@ -117,19 +113,7 @@ void WebResourceLoader::didReceiveResponse(const ResourceResponse& response, boo
     if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(m_coreLoader.get(), response))
         return;
 
-    bool shoudCallCoreLoaderDidReceiveResponse = true;
-#if USE(QUICK_LOOK)
-    // Refrain from calling didReceiveResponse if QuickLook will convert this response, since the MIME type of the
-    // converted resource isn't yet known. WebResourceLoaderQuickLookDelegate will later call didReceiveResponse upon
-    // receiving the converted data.
-    bool isMainLoad = m_coreLoader->documentLoader()->mainResourceLoader() == m_coreLoader;
-    if (isMainLoad && QuickLookHandle::shouldCreateForMIMEType(response.mimeType())) {
-        m_coreLoader->documentLoader()->setQuickLookHandle(QuickLookHandle::create(*m_coreLoader, response));
-        shoudCallCoreLoaderDidReceiveResponse = false;
-    }
-#endif
-    if (shoudCallCoreLoaderDidReceiveResponse)
-        m_coreLoader->didReceiveResponse(response);
+    m_coreLoader->didReceiveResponse(response);
 
     // If m_coreLoader becomes null as a result of the didReceiveResponse callback, we can't use the send function(). 
     if (!m_coreLoader)
@@ -148,12 +132,6 @@ void WebResourceLoader::didReceiveData(const IPC::DataReference& data, int64_t e
         m_hasReceivedData = true;
     }
 
-#if USE(QUICK_LOOK)
-    if (QuickLookHandle* quickLookHandle = m_coreLoader->documentLoader()->quickLookHandle()) {
-        if (quickLookHandle->didReceiveData(adoptCF(CFDataCreate(kCFAllocatorDefault, data.data(), data.size())).get()))
-            return;
-    }
-#endif
     m_coreLoader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, DataPayloadBytes);
 }
 
@@ -162,12 +140,6 @@ void WebResourceLoader::didFinishResourceLoad(double finishTime)
     LOG(Network, "(WebProcess) WebResourceLoader::didFinishResourceLoad for '%s'", m_coreLoader->url().string().latin1().data());
     RELEASE_LOG_IF_ALLOWED("didFinishResourceLoad: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_trackingParameters.pageID, m_trackingParameters.frameID, m_trackingParameters.resourceID);
 
-#if USE(QUICK_LOOK)
-    if (QuickLookHandle* quickLookHandle = m_coreLoader->documentLoader()->quickLookHandle()) {
-        if (quickLookHandle->didFinishLoading())
-            return;
-    }
-#endif
     m_coreLoader->didFinishLoading(finishTime);
 }
 
@@ -176,10 +148,6 @@ void WebResourceLoader::didFailResourceLoad(const ResourceError& error)
     LOG(Network, "(WebProcess) WebResourceLoader::didFailResourceLoad for '%s'", m_coreLoader->url().string().latin1().data());
     RELEASE_LOG_IF_ALLOWED("didFailResourceLoad: (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_trackingParameters.pageID, m_trackingParameters.frameID, m_trackingParameters.resourceID);
 
-#if USE(QUICK_LOOK)
-    if (QuickLookHandle* quickLookHandle = m_coreLoader->documentLoader()->quickLookHandle())
-        quickLookHandle->didFail();
-#endif
     if (m_coreLoader->documentLoader()->applicationCacheHost()->maybeLoadFallbackForError(m_coreLoader.get(), error))
         return;
     m_coreLoader->didFail(error);
@@ -193,18 +161,6 @@ void WebResourceLoader::didReceiveResource(const ShareableResource::Handle& hand
 
     RefPtr<SharedBuffer> buffer = handle.tryWrapInSharedBuffer();
 
-#if USE(QUICK_LOOK)
-    if (QuickLookHandle* quickLookHandle = m_coreLoader->documentLoader()->quickLookHandle()) {
-        if (buffer) {
-            if (quickLookHandle->didReceiveData(buffer->existingCFData())) {
-                quickLookHandle->didFinishLoading();
-                return;
-            }
-        } else
-            quickLookHandle->didFail();
-    }
-#endif
-
     if (!buffer) {
         LOG_ERROR("Unable to create buffer from ShareableResource sent from the network process.");
         RELEASE_LOG_IF_ALLOWED("didReceiveResource: Unable to create SharedBuffer (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ")", m_trackingParameters.pageID, m_trackingParameters.frameID, m_trackingParameters.resourceID);