- Revision
- 199644
- Author
- [email protected]
- Date
- 2016-04-17 11:58:56 -0700 (Sun, 17 Apr 2016)
Log Message
[WK2][iOS] Do not dlopen() QuickLook in the NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=156639
Reviewed by Darin Adler.
Source/WebCore:
Do not unnecessarily dlopen() QuickLook in the NetworkProcess on iOS, as
we already dlopen() this library in the WebContent process. This patch
moves the resource response MIME type adjusting code for QuickLook from
adjustMIMETypeIfNecessary() to a new adjustMIMETypeForQuickLook() function.
adjustMIMETypeIfNecessary() is called in didReceiveResponse() in the Network
process side, for *every* resource response, even though QuickLook can only
be used to preview main resources. The new adjustMIMETypeForQuickLook()
function is called in the QuickLookHandle::createIfNecessary() factory
function, right before checking the MIME type to determine if we need to
use QuickLook, and after checking that the load is for a main resource.
In the WebKit2 case, the factory function is called from
WebResourceLoader::didReceiveResponse(), on the WebContent process side.
This patch speeds up the first page load during PLT by ~22%, because the
first load no longer triggers a dlopen() to QuickLook in the NetworkProcess.
The overall PLT score seems to be progressed by 0.9-1% as well. The change
should also be memory-positive as we no longer need to dlopen() the
QuickLook library in the NetworkProcess at all (and we would already dlopen()
it on the WebContent process side anyway). Sadly, PLUM benchmark does not
show the memory benefit because it does not measure the memory used by the
Network process.
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
Refactor the code a bit for clarity, so that we only
ResourceHandle::setQuickLookHandle() when QuickLookHandle::createIfNecessary()
returns a non-null pointer.
* platform/network/ios/QuickLook.h:
- Rename the factories from create() to createIfNecessary() given that they
return nullptr when it is unnecessary to create such handle (i.e. this is not
a main resource loader, or it is unecessary given the response's MIME type.
- Make shouldCreateForMIMEType() private now that this is always called inside
the factory functions.
* platform/network/ios/QuickLook.mm:
(adjustMIMETypeForQuickLook):
Extracted code for adjusting the MIME type for QuickLook from the generic
adjustMIMETypeIfNecessary() in WebCoreURLResponseIOS.mm to its own function
here.
(WebCore::QuickLookHandle::createIfNecessary):
Call adjustMIMETypeForQuickLook() before checking the MIME type.
* platform/network/ios/WebCoreURLResponseIOS.mm:
(WebCore::adjustMIMETypeIfNecessary):
Extracted QuickLook-specific code to QuickLook.mm.
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
Refactor the code a bit for clarity, so that we only
ResourceHandle::setQuickLookHandle() when QuickLookHandle::createIfNecessary()
returns a non-null pointer.
Source/WebKit2:
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResponse):
Move checks for main resource load and for MIME type inside of
QuickLookHandle::createIfNecessary(), for consistency with the
other QuickLookHandle factory functions.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (199643 => 199644)
--- trunk/Source/WebCore/ChangeLog 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebCore/ChangeLog 2016-04-17 18:58:56 UTC (rev 199644)
@@ -1,3 +1,64 @@
+2016-04-17 Chris Dumez <[email protected]>
+
+ [WK2][iOS] Do not dlopen() QuickLook in the NetworkProcess
+ https://bugs.webkit.org/show_bug.cgi?id=156639
+
+ Reviewed by Darin Adler.
+
+ Do not unnecessarily dlopen() QuickLook in the NetworkProcess on iOS, as
+ we already dlopen() this library in the WebContent process. This patch
+ moves the resource response MIME type adjusting code for QuickLook from
+ adjustMIMETypeIfNecessary() to a new adjustMIMETypeForQuickLook() function.
+ adjustMIMETypeIfNecessary() is called in didReceiveResponse() in the Network
+ process side, for *every* resource response, even though QuickLook can only
+ be used to preview main resources. The new adjustMIMETypeForQuickLook()
+ function is called in the QuickLookHandle::createIfNecessary() factory
+ function, right before checking the MIME type to determine if we need to
+ use QuickLook, and after checking that the load is for a main resource.
+ In the WebKit2 case, the factory function is called from
+ WebResourceLoader::didReceiveResponse(), on the WebContent process side.
+
+ This patch speeds up the first page load during PLT by ~22%, because the
+ first load no longer triggers a dlopen() to QuickLook in the NetworkProcess.
+ The overall PLT score seems to be progressed by 0.9-1% as well. The change
+ should also be memory-positive as we no longer need to dlopen() the
+ QuickLook library in the NetworkProcess at all (and we would already dlopen()
+ it on the WebContent process side anyway). Sadly, PLUM benchmark does not
+ show the memory benefit because it does not measure the memory used by the
+ Network process.
+
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
+ Refactor the code a bit for clarity, so that we only
+ ResourceHandle::setQuickLookHandle() when QuickLookHandle::createIfNecessary()
+ returns a non-null pointer.
+
+ * platform/network/ios/QuickLook.h:
+ - Rename the factories from create() to createIfNecessary() given that they
+ return nullptr when it is unnecessary to create such handle (i.e. this is not
+ a main resource loader, or it is unecessary given the response's MIME type.
+ - Make shouldCreateForMIMEType() private now that this is always called inside
+ the factory functions.
+
+ * platform/network/ios/QuickLook.mm:
+ (adjustMIMETypeForQuickLook):
+ Extracted code for adjusting the MIME type for QuickLook from the generic
+ adjustMIMETypeIfNecessary() in WebCoreURLResponseIOS.mm to its own function
+ here.
+
+ (WebCore::QuickLookHandle::createIfNecessary):
+ Call adjustMIMETypeForQuickLook() before checking the MIME type.
+
+ * platform/network/ios/WebCoreURLResponseIOS.mm:
+ (WebCore::adjustMIMETypeIfNecessary):
+ Extracted QuickLook-specific code to QuickLook.mm.
+
+ * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+ (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
+ Refactor the code a bit for clarity, so that we only
+ ResourceHandle::setQuickLookHandle() when QuickLookHandle::createIfNecessary()
+ returns a non-null pointer.
+
2016-04-17 Brady Eidson <[email protected]>
Clean up IDBBindingUtilities.
Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (199643 => 199644)
--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2016-04-17 18:58:56 UTC (rev 199644)
@@ -166,9 +166,10 @@
#endif
#if USE(QUICK_LOOK)
- m_handle->setQuickLookHandle(QuickLookHandle::create(m_handle, this, cfResponse));
- if (m_handle->quickLookHandle())
- cfResponse = m_handle->quickLookHandle()->cfResponse();
+ if (auto quickLookHandle = QuickLookHandle::createIfNecessary(*m_handle, this, cfResponse)) {
+ cfResponse = quickLookHandle->cfResponse();
+ m_handle->setQuickLookHandle(WTFMove(quickLookHandle));
+ }
#endif
ResourceResponse resourceResponse(cfResponse);
Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.h (199643 => 199644)
--- trunk/Source/WebCore/platform/network/ios/QuickLook.h 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.h 2016-04-17 18:58:56 UTC (rev 199644)
@@ -78,14 +78,13 @@
class QuickLookHandle {
WTF_MAKE_NONCOPYABLE(QuickLookHandle);
public:
- WEBCORE_EXPORT static bool shouldCreateForMIMEType(const String&);
-
- static std::unique_ptr<QuickLookHandle> create(ResourceHandle*, NSURLConnection *, NSURLResponse *, id delegate);
+ static std::unique_ptr<QuickLookHandle> createIfNecessary(ResourceHandle&, NSURLConnection *, NSURLResponse *, id delegate);
#if USE(CFNETWORK)
- static std::unique_ptr<QuickLookHandle> create(ResourceHandle*, SynchronousResourceHandleCFURLConnectionDelegate*, CFURLResponseRef);
+ static std::unique_ptr<QuickLookHandle> createIfNecessary(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 static std::unique_ptr<QuickLookHandle> createIfNecessary(ResourceLoader&, NSURLResponse *);
WEBCORE_EXPORT ~QuickLookHandle();
@@ -108,6 +107,7 @@
QLPreviewConverter *converter() const { return m_converter.get(); }
private:
+ static std::unique_ptr<QuickLookHandle> create(ResourceHandle&, NSURLConnection *, NSURLResponse *, id delegate);
QuickLookHandle(NSURL *, NSURLConnection *, NSURLResponse *, id delegate);
RetainPtr<NSURL> m_firstRequestURL;
Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (199643 => 199644)
--- trunk/Source/WebCore/platform/network/ios/QuickLook.mm 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.mm 2016-04-17 18:58:56 UTC (rev 199644)
@@ -36,10 +36,14 @@
#import "ResourceHandle.h"
#import "ResourceLoader.h"
#import "RuntimeApplicationChecks.h"
+#import "SubresourceLoader.h"
#import "SynchronousResourceHandleCFURLConnectionDelegate.h"
+#import "UTIUtilities.h"
#import "WebCoreResourceHandleAsDelegate.h"
+#import "WebCoreSystemInterface.h"
#import "WebCoreURLResponseIOS.h"
#import <Foundation/Foundation.h>
+#import <MobileCoreServices/MobileCoreServices.h>
#import <wtf/NeverDestroyed.h>
#import <wtf/StdLibExtras.h>
#import <wtf/Threading.h>
@@ -48,6 +52,14 @@
#import "QuickLookSoftLink.h"
+SOFT_LINK_FRAMEWORK(MobileCoreServices)
+
+SOFT_LINK(MobileCoreServices, UTTypeCreatePreferredIdentifierForTag, CFStringRef, (CFStringRef inTagClass, CFStringRef inTag, CFStringRef inConformingToUTI), (inTagClass, inTag, inConformingToUTI))
+
+SOFT_LINK_CONSTANT(MobileCoreServices, kUTTagClassFilenameExtension, CFStringRef)
+
+#define kUTTagClassFilenameExtension getkUTTagClassFilenameExtension()
+
using namespace WebCore;
NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
@@ -96,6 +108,43 @@
return contentDictionary;
}
+// We must ensure that the MIME type is correct, so that QuickLook's web plugin is called when needed.
+// We filter the basic MIME types so that we don't do unnecessary work in standard browsing situations.
+static RetainPtr<CFStringRef> adjustMIMETypeForQuickLook(CFURLResponseRef cfResponse)
+{
+ RetainPtr<CFStringRef> mimeType = CFURLResponseGetMIMEType(cfResponse);
+ if (!shouldUseQuickLookForMIMEType(mimeType.get()))
+ return mimeType;
+
+ RetainPtr<CFStringRef> suggestedFilename = adoptCF(CFURLResponseCopySuggestedFilename(cfResponse));
+ RetainPtr<CFStringRef> quickLookMIMEType = adoptCF((CFStringRef)QLTypeCopyBestMimeTypeForFileNameAndMimeType((NSString *)suggestedFilename.get(), (NSString *)mimeType.get()));
+ if (!quickLookMIMEType) {
+ auto url = ""
+ if (![(NSURL *)url isFileURL])
+ return mimeType;
+ RetainPtr<CFStringRef> extension = adoptCF(CFURLCopyPathExtension(url));
+ if (!extension)
+ return mimeType;
+ RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), nullptr));
+ quickLookMIMEType = mimeTypeFromUTITree(uti.get());
+ if (!quickLookMIMEType)
+ return mimeType;
+ }
+
+ if (!mimeType || CFStringCompare(mimeType.get(), quickLookMIMEType.get(), kCFCompareCaseInsensitive) != kCFCompareEqualTo) {
+ CFURLResponseSetMIMEType(cfResponse, quickLookMIMEType.get());
+ return quickLookMIMEType;
+ }
+
+ return mimeType;
+}
+
+static bool shouldCreateForResponse(CFURLResponseRef cfResponse)
+{
+ RetainPtr<CFStringRef> mimeType = adjustMIMETypeForQuickLook(cfResponse);
+ return [QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)mimeType.get()];
+}
+
void WebCore::addQLPreviewConverterWithFileForURL(NSURL *url, id converter, NSString *fileName)
{
ASSERT(url);
@@ -396,29 +445,35 @@
LOG(Network, "QuickLookHandle::QuickLookHandle() - previewFileName: %s", [m_converter previewFileName]);
}
-std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
+static bool shouldCreate(ResourceHandle& handle, CFURLResponseRef response)
{
- ASSERT_ARG(handle, handle);
- if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
- return nullptr;
+ return handle.firstRequest().requester() == ResourceRequest::Requester::Main && shouldCreateForResponse(response);
+}
- std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([handle->firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], connection, nsResponse, delegate));
- handle->client()->didCreateQuickLookHandle(*quickLookHandle);
+std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle& handle, NSURLConnection *connection, NSURLResponse *response, id delegate)
+{
+ std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([handle.firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], connection, response, delegate));
+ handle.client()->didCreateQuickLookHandle(*quickLookHandle);
return quickLookHandle;
}
+std::unique_ptr<QuickLookHandle> QuickLookHandle::createIfNecessary(ResourceHandle& handle, NSURLConnection *connection, NSURLResponse *response, id delegate)
+{
+ if (!shouldCreate(handle, response._CFURLResponse))
+ return nullptr;
+
+ return create(handle, connection, response, delegate);
+}
+
#if USE(CFNETWORK)
-std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
+std::unique_ptr<QuickLookHandle> QuickLookHandle::createIfNecessary(ResourceHandle& handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
{
- ASSERT_ARG(handle, handle);
- if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
+ if (!shouldCreate(handle, cfResponse))
return nullptr;
- NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
+ NSURLResponse *response = [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;
+ return create(handle, nil, response, delegate);
}
CFURLResponseRef QuickLookHandle::cfResponse()
@@ -427,17 +482,17 @@
}
#endif
-bool QuickLookHandle::shouldCreateForMIMEType(const String& mimeType)
+std::unique_ptr<QuickLookHandle> QuickLookHandle::createIfNecessary(ResourceLoader& loader, NSURLResponse *response)
{
- return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
-}
+ bool isMainResourceLoad = loader.documentLoader()->mainResourceLoader() == &loader;
+ if (!isMainResourceLoad)
+ return nullptr;
-std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceLoader& loader, const ResourceResponse& response)
-{
- ASSERT(shouldCreateForMIMEType(response.mimeType()));
+ if (!shouldCreateForResponse(response._CFURLResponse))
+ return nullptr;
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], nil, response, delegate.get()));
[delegate setQuickLookHandle:quickLookHandle.get()];
loader.didCreateQuickLookHandle(*quickLookHandle);
return quickLookHandle;
Modified: trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm (199643 => 199644)
--- trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm 2016-04-17 18:58:56 UTC (rev 199644)
@@ -28,22 +28,7 @@
#import "config.h"
#import "WebCoreURLResponseIOS.h"
-#import "UTIUtilities.h"
-#import "WebCoreSystemInterface.h"
-#import "QuickLook.h"
-#import "QuickLookSoftLink.h"
-#import "SoftLinking.h"
-#import <MobileCoreServices/MobileCoreServices.h>
-
-SOFT_LINK_FRAMEWORK(MobileCoreServices)
-
-SOFT_LINK(MobileCoreServices, UTTypeCreatePreferredIdentifierForTag, CFStringRef, (CFStringRef inTagClass, CFStringRef inTag, CFStringRef inConformingToUTI), (inTagClass, inTag, inConformingToUTI))
-
-SOFT_LINK_CONSTANT(MobileCoreServices, kUTTagClassFilenameExtension, CFStringRef)
-
-#define kUTTagClassFilenameExtension getkUTTagClassFilenameExtension()
-
namespace WebCore {
void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
@@ -53,27 +38,6 @@
if (!updatedMIMEType)
updatedMIMEType = defaultMIMEType().createCFString();
-#if USE(QUICK_LOOK)
- // We must ensure that the MIME type is correct, so that QuickLook's web plugin is called when needed.
- // We filter the basic MIME types so that we don't do unnecessary work in standard browsing situations.
- if (shouldUseQuickLookForMIMEType((NSString *)updatedMIMEType.get())) {
- RetainPtr<CFStringRef> suggestedFilename = adoptCF(CFURLResponseCopySuggestedFilename(cfResponse));
- RetainPtr<CFStringRef> quickLookMIMEType = adoptCF((CFStringRef)QLTypeCopyBestMimeTypeForFileNameAndMimeType((NSString *)suggestedFilename.get(), (NSString *)mimeType.get()));
- if (!quickLookMIMEType) {
- auto url = ""
- if ([(NSURL *)url isFileURL]) {
- RetainPtr<CFStringRef> extension = adoptCF(CFURLCopyPathExtension(url));
- if (extension) {
- RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), nullptr));
- quickLookMIMEType = mimeTypeFromUTITree(uti.get());
- }
- }
- }
-
- if (quickLookMIMEType)
- updatedMIMEType = quickLookMIMEType;
- }
-#endif // USE(QUICK_LOOK)
if (!mimeType || CFStringCompare(mimeType.get(), updatedMIMEType.get(), kCFCompareCaseInsensitive) != kCFCompareEqualTo)
CFURLResponseSetMIMEType(cfResponse, updatedMIMEType.get());
}
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm (199643 => 199644)
--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm 2016-04-17 18:58:56 UTC (rev 199644)
@@ -162,9 +162,10 @@
#endif
#if USE(QUICK_LOOK)
- m_handle->setQuickLookHandle(QuickLookHandle::create(m_handle, connection, r, self));
- if (m_handle->quickLookHandle())
- r = m_handle->quickLookHandle()->nsResponse();
+ if (auto quickLookHandle = QuickLookHandle::createIfNecessary(*m_handle, connection, r, self)) {
+ r = quickLookHandle->nsResponse();
+ m_handle->setQuickLookHandle(WTFMove(quickLookHandle));
+ }
#endif
ResourceResponse resourceResponse(r);
Modified: trunk/Source/WebKit2/ChangeLog (199643 => 199644)
--- trunk/Source/WebKit2/ChangeLog 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebKit2/ChangeLog 2016-04-17 18:58:56 UTC (rev 199644)
@@ -1,3 +1,16 @@
+2016-04-17 Chris Dumez <[email protected]>
+
+ [WK2][iOS] Do not dlopen() QuickLook in the NetworkProcess
+ https://bugs.webkit.org/show_bug.cgi?id=156639
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/Network/WebResourceLoader.cpp:
+ (WebKit::WebResourceLoader::didReceiveResponse):
+ Move checks for main resource load and for MIME type inside of
+ QuickLookHandle::createIfNecessary(), for consistency with the
+ other QuickLookHandle factory functions.
+
2016-04-16 Dan Bernstein <[email protected]>
[Mac] Web Content service with a restricted entitlement may load arbitrary dylibs
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (199643 => 199644)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2016-04-17 18:49:53 UTC (rev 199643)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2016-04-17 18:58:56 UTC (rev 199644)
@@ -114,12 +114,12 @@
// 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));
+ if (auto quickLookHandle = QuickLookHandle::createIfNecessary(*m_coreLoader, response.nsURLResponse())) {
+ m_coreLoader->documentLoader()->setQuickLookHandle(WTFMove(quickLookHandle));
shoudCallCoreLoaderDidReceiveResponse = false;
}
#endif
+
if (shoudCallCoreLoaderDidReceiveResponse)
m_coreLoader->didReceiveResponse(response);