Diff
Modified: trunk/Source/WebCore/ChangeLog (183597 => 183598)
--- trunk/Source/WebCore/ChangeLog 2015-04-30 00:46:40 UTC (rev 183597)
+++ trunk/Source/WebCore/ChangeLog 2015-04-30 01:18:18 UTC (rev 183598)
@@ -1,3 +1,50 @@
+2015-04-29 David Kilzer <[email protected]>
+
+ Attempt #2: Switch QuickLook soft-linking to use QuickLookSoftLink.{h,mm}
+ <http://webkit.org/b/144362>
+
+ Reviewed by Andy Estes.
+
+ This patch switches soft-linking of QuickLook.framework to
+ QuickLookSoftLink.{h,mm} so that we stop exporting unintended
+ symbols.
+
+ No new tests since no change in behavior.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ - Add QuickLookSoftLinking.{h,mm} to the project.
+
+ * platform/ios/QuickLookSoftLink.h: Added.
+ * platform/ios/QuickLookSoftLink.mm: Added.
+ * platform/mac/SoftLinking.h:
+ (SOFT_LINK_CLASS_FOR_HEADER): Add macro.
+ (SOFT_LINK_CLASS_FOR_SOURCE): Add macro.
+ (SOFT_LINK_POINTER_FOR_HEADER): Add macro.
+ (SOFT_LINK_POINTER_FOR_SOURCE): Add macro.
+
+ * platform/network/ios/QuickLook.h:
+ - Remove unused declarations.
+
+ * platform/network/ios/QuickLook.mm:
+ (WebCore::QLPreviewConverterClass): Deleted.
+ (WebCore::QLTypeCopyBestMimeTypeForFileNameAndMimeType): Deleted.
+ (WebCore::QLTypeCopyBestMimeTypeForURLAndMimeType): Deleted.
+ (WebCore::QLTypeCopyUTIForURLAndMimeType): Deleted.
+ - Remove SOFT_LINK macros and unused methods after switching to
+ new QuickLookSoftLink.{h,mm}.
+ (WebCore::QLPreviewGetSupportedMIMETypesSet):
+ - Switch to use NeverDestroyed<>.
+ (WebCore::registerQLPreviewConverterIfNeeded):
+ (createQLPreviewProtocol):
+ (WebCore::QLPreviewProtocol):
+ (WebCore::QuickLookHandle::QuickLookHandle):
+ (WebCore::QuickLookHandle::create):
+ (WebCore::QuickLookHandle::shouldCreateForMIMEType):
+ - Simplify code when using QuickLookSoftLink.h.
+
+ * platform/network/ios/WebCoreURLResponseIOS.mm:
+ - Include QuickLookSoftLink.h header.
+
2015-04-29 Simon Fraser <[email protected]>
Compute the non-fast-scrollable region in main-document coordinates
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (183597 => 183598)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-04-30 00:46:40 UTC (rev 183597)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-04-30 01:18:18 UTC (rev 183598)
@@ -1599,7 +1599,9 @@
44311CD912E4E257000A8D19 /* DOMDocumentFragmentPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 44311CD412E4E22D000A8D19 /* DOMDocumentFragmentPrivate.h */; };
44311F8212E4E66C000A8D19 /* DOMDocumentFragmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 85E711450AC5D5340053270F /* DOMDocumentFragmentInternal.h */; };
443817FF1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */; };
+ 443917FF1A91B2F8006E04F2 /* QuickLookSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */; };
443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */; };
+ 443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */; };
443F04270E75C8FB007E5407 /* NetworkStateNotifierIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */; };
4449A4051A964B0000B64AD5 /* CoreMediaSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4449A4041A964B0000B64AD5 /* CoreMediaSPI.h */; };
444D4E230F708B2E003158E0 /* WebCoreURLResponseIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */; };
@@ -8764,7 +8766,9 @@
44311CD412E4E22D000A8D19 /* DOMDocumentFragmentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDocumentFragmentPrivate.h; sourceTree = "<group>"; };
44311CD512E4E22D000A8D19 /* DOMDocumentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDocumentPrivate.h; sourceTree = "<group>"; };
443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreMediaSoftLink.cpp; sourceTree = "<group>"; };
+ 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ios/QuickLookSoftLink.mm; sourceTree = "<group>"; };
443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreMediaSoftLink.h; sourceTree = "<group>"; };
+ 443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios/QuickLookSoftLink.h; sourceTree = "<group>"; };
443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkStateNotifierIOS.mm; sourceTree = "<group>"; };
4449A4041A964B0000B64AD5 /* CoreMediaSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreMediaSPI.h; sourceTree = "<group>"; };
444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponseIOS.mm; sourceTree = "<group>"; };
@@ -18849,6 +18853,8 @@
C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */,
E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */,
AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */,
+ 443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */,
+ 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */,
CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */,
CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */,
44C363EE0FAA7BB30097F8CC /* RuntimeApplicationChecksIOS.h */,
@@ -26052,6 +26058,7 @@
550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
CE12523D1A1676CD00864480 /* QuartzCoreSPI.h in Headers */,
442AF7A9102CDDEA008FD4D3 /* QuickLook.h in Headers */,
+ 443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */,
A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */,
CE1252391A166FA000864480 /* QuickLookSPI.h in Headers */,
A10DBF4718F92317000D70C6 /* QuickLookHandleClient.h in Headers */,
@@ -29551,6 +29558,7 @@
CDEE393717974259001D7580 /* PublicURLManager.cpp in Sources */,
550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */,
442AF7AA102CDDEA008FD4D3 /* QuickLook.mm in Sources */,
+ 443917FF1A91B2F8006E04F2 /* QuickLookSoftLink.mm in Sources */,
072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */,
379E371613736A6600B9E919 /* QuotedPrintable.cpp in Sources */,
5A574F28131DB96D00471B88 /* QuotesData.cpp in Sources */,
Added: trunk/Source/WebCore/platform/ios/QuickLookSoftLink.h (0 => 183598)
--- trunk/Source/WebCore/platform/ios/QuickLookSoftLink.h (rev 0)
+++ trunk/Source/WebCore/platform/ios/QuickLookSoftLink.h 2015-04-30 01:18:18 UTC (rev 183598)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#if USE(QUICK_LOOK)
+
+#include "QuickLookSPI.h"
+#include "SoftLinking.h"
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, QuickLook)
+
+SOFT_LINK_CLASS_FOR_HEADER(WebCore, QuickLook, QLPreviewConverter)
+
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, QuickLook, QLPreviewGetSupportedMIMETypes, NSSet *, (), ())
+#define QLPreviewGetSupportedMIMETypes softLink_QuickLook_QLPreviewGetSupportedMIMETypes
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, QuickLook, QLTypeCopyBestMimeTypeForFileNameAndMimeType, NSString *, (NSString *fileName, NSString *mimeType), (fileName, mimeType))
+#define QLTypeCopyBestMimeTypeForFileNameAndMimeType softLink_QuickLook_QLTypeCopyBestMimeTypeForFileNameAndMimeType
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, QuickLook, QLTypeCopyBestMimeTypeForURLAndMimeType, NSString *, (NSURL *url, NSString *mimeType), (url, mimeType))
+#define QLTypeCopyBestMimeTypeForURLAndMimeType softLink_QuickLook_QLTypeCopyBestMimeTypeForURLAndMimeType
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, QuickLook, QLTypeCopyUTIForURLAndMimeType, NSString *, (NSURL *url, NSString *mimeType), (url, mimeType))
+#define QLTypeCopyUTIForURLAndMimeType softLink_QuickLook_QLTypeCopyUTIForURLAndMimeType
+
+SOFT_LINK_POINTER_FOR_HEADER(WebCore, QuickLook, QLPreviewScheme, NSString *)
+#define QLPreviewScheme get_QuickLook_QLPreviewScheme()
+
+#endif // USE(QUICK_LOOK)
Added: trunk/Source/WebCore/platform/ios/QuickLookSoftLink.mm (0 => 183598)
--- trunk/Source/WebCore/platform/ios/QuickLookSoftLink.mm (rev 0)
+++ trunk/Source/WebCore/platform/ios/QuickLookSoftLink.mm 2015-04-30 01:18:18 UTC (rev 183598)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+
+#if USE(QUICK_LOOK)
+
+#import "QuickLookSPI.h"
+#import "SoftLinking.h"
+
+SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, QuickLook)
+
+SOFT_LINK_CLASS_FOR_SOURCE(WebCore, QuickLook, QLPreviewConverter)
+
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, QuickLook, QLPreviewGetSupportedMIMETypes, NSSet *, (), ())
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, QuickLook, QLTypeCopyBestMimeTypeForFileNameAndMimeType, NSString *, (NSString *fileName, NSString *mimeType), (fileName, mimeType))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, QuickLook, QLTypeCopyBestMimeTypeForURLAndMimeType, NSString *, (NSURL *url, NSString *mimeType), (url, mimeType))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, QuickLook, QLTypeCopyUTIForURLAndMimeType, NSString *, (NSURL *url, NSString *mimeType), (url, mimeType))
+
+SOFT_LINK_POINTER_FOR_SOURCE(WebCore, QuickLook, QLPreviewScheme, NSString *)
+
+#endif // USE(QUICK_LOOK)
Modified: trunk/Source/WebCore/platform/mac/SoftLinking.h (183597 => 183598)
--- trunk/Source/WebCore/platform/mac/SoftLinking.h 2015-04-30 00:46:40 UTC (rev 183597)
+++ trunk/Source/WebCore/platform/mac/SoftLinking.h 2015-04-30 01:18:18 UTC (rev 183598)
@@ -317,6 +317,42 @@
} \
}
+#define SOFT_LINK_CLASS_FOR_HEADER(functionNamespace, framework, className) \
+ @class className; \
+ namespace functionNamespace { \
+ extern Class (*get_##framework##_##className##Class)(); \
+ className *alloc##className##Instance(); \
+ inline className *alloc##className##Instance() \
+ { \
+ return [get_##framework##_##className##Class() alloc]; \
+ } \
+ }
+
+#define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
+ @class className; \
+ namespace functionNamespace { \
+ static Class init##className(); \
+ Class (*get_##framework##_##className##Class)() = init##className; \
+ static Class class##className; \
+ \
+ static Class className##Function() \
+ { \
+ return class##className; \
+ } \
+ \
+ static Class init##className() \
+ { \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ framework##Library(); \
+ class##className = objc_getClass(#className); \
+ RELEASE_ASSERT(class##className); \
+ get_##framework##_##className##Class = className##Function; \
+ }); \
+ return class##className; \
+ } \
+ }
+
#define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
WTF_EXTERN_C_BEGIN \
extern const variableType variableName; \
@@ -374,4 +410,33 @@
} \
}
+#define SOFT_LINK_POINTER_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
+ namespace functionNamespace { \
+ extern variableType (*get_##framework##_##variableName)(); \
+ }
+
+#define SOFT_LINK_POINTER_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
+ namespace functionNamespace { \
+ static variableType init##framework##variableName(); \
+ variableType (*get_##framework##_##variableName)() = init##framework##variableName; \
+ static variableType pointer##framework##variableName; \
+ \
+ static variableType pointer##framework##variableName##Function() \
+ { \
+ return pointer##framework##variableName; \
+ } \
+ \
+ static variableType init##framework##variableName() \
+ { \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ void** pointer = static_cast<void**>(dlsym(framework##Library(), #variableName)); \
+ RELEASE_ASSERT_WITH_MESSAGE(pointer, "%s", dlerror()); \
+ pointer##framework##variableName = static_cast<variableType>(*pointer); \
+ get_##framework##_##variableName = pointer##framework##variableName##Function; \
+ }); \
+ return pointer##framework##variableName; \
+ } \
+ }
+
#endif // SoftLinking_h
Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.h (183597 => 183598)
--- trunk/Source/WebCore/platform/network/ios/QuickLook.h 2015-04-30 00:46:40 UTC (rev 183597)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.h 2015-04-30 01:18:18 UTC (rev 183598)
@@ -57,10 +57,6 @@
class ResourceResponse;
class SynchronousResourceHandleCFURLConnectionDelegate;
-Class QLPreviewConverterClass();
-NSString *QLTypeCopyBestMimeTypeForFileNameAndMimeType(NSString *fileName, NSString *mimeType);
-NSString *QLTypeCopyBestMimeTypeForURLAndMimeType(NSURL *, NSString *mimeType);
-
WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
// Used for setting the permissions on the saved QL content
Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (183597 => 183598)
--- trunk/Source/WebCore/platform/network/ios/QuickLook.mm 2015-04-30 00:46:40 UTC (rev 183597)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.mm 2015-04-30 01:18:18 UTC (rev 183598)
@@ -32,12 +32,11 @@
#import "FileSystemIOS.h"
#import "Logging.h"
#import "NSFileManagerSPI.h"
-#import "QuickLookSPI.h"
+#import "QuickLookSoftLink.h"
#import "ResourceError.h"
#import "ResourceHandle.h"
#import "ResourceLoader.h"
#import "RuntimeApplicationChecksIOS.h"
-#import "SoftLinking.h"
#import "SynchronousResourceHandleCFURLConnectionDelegate.h"
#import "WebCoreURLResponseIOS.h"
#import <Foundation/Foundation.h>
@@ -56,60 +55,14 @@
@end
#endif
-SOFT_LINK_FRAMEWORK_OPTIONAL(QuickLook)
-SOFT_LINK_CLASS(QuickLook, QLPreviewConverter)
-SOFT_LINK_MAY_FAIL(QuickLook, QLPreviewGetSupportedMIMETypes, NSSet *, (), ())
-SOFT_LINK_MAY_FAIL(QuickLook, QLTypeCopyBestMimeTypeForFileNameAndMimeType, NSString *, (NSString *fileName, NSString *mimeType), (fileName, mimeType))
-SOFT_LINK_MAY_FAIL(QuickLook, QLTypeCopyBestMimeTypeForURLAndMimeType, NSString *, (NSURL *url, NSString *mimeType), (url, mimeType))
-SOFT_LINK_MAY_FAIL(QuickLook, QLTypeCopyUTIForURLAndMimeType, NSString *, (NSURL *url, NSString *mimeType), (url, mimeType))
-SOFT_LINK_CONSTANT_MAY_FAIL(QuickLook, QLPreviewScheme, NSString *)
-
-namespace WebCore {
- NSString *QLTypeCopyUTIForURLAndMimeType(NSURL *url, NSString *mimeType);
-}
-
using namespace WebCore;
-Class WebCore::QLPreviewConverterClass()
-{
-#define QLPreviewConverter getQLPreviewConverterClass()
- return QLPreviewConverter;
-#undef QLPreviewConverter
-}
-
-NSString *WebCore::QLTypeCopyBestMimeTypeForFileNameAndMimeType(NSString *fileName, NSString *mimeType)
-{
- if (!canLoadQLTypeCopyBestMimeTypeForFileNameAndMimeType())
- return nil;
-
- return ::QLTypeCopyBestMimeTypeForFileNameAndMimeType(fileName, mimeType);
-}
-
-NSString *WebCore::QLTypeCopyBestMimeTypeForURLAndMimeType(NSURL *url, NSString *mimeType)
-{
- if (!canLoadQLTypeCopyBestMimeTypeForURLAndMimeType())
- return nil;
-
- return ::QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType);
-}
-
NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
{
- if (!canLoadQLPreviewGetSupportedMIMETypes())
- return nil;
-
- static NSSet *set = adoptNS(::QLPreviewGetSupportedMIMETypes()).leakRef();
- return set;
+ static NeverDestroyed<RetainPtr<NSSet>> set = QLPreviewGetSupportedMIMETypes();
+ return set.get().get();
}
-NSString *WebCore::QLTypeCopyUTIForURLAndMimeType(NSURL *url, NSString *mimeType)
-{
- if (!canLoadQLTypeCopyUTIForURLAndMimeType())
- return nil;
-
- return ::QLTypeCopyUTIForURLAndMimeType(url, mimeType);
-}
-
NSDictionary *WebCore::QLFileAttributes()
{
// Set file perms to owner read/write only
@@ -190,12 +143,12 @@
RetainPtr<NSURLRequest> WebCore::registerQLPreviewConverterIfNeeded(NSURL *url, NSString *mimeType, NSData *data)
{
- RetainPtr<NSString> updatedMIMEType = adoptNS(WebCore::QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
+ RetainPtr<NSString> updatedMIMEType = adoptNS(QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
- if ([WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
- RetainPtr<NSString> uti = adoptNS(WebCore::QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
+ if ([QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
+ RetainPtr<NSString> uti = adoptNS(QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
- RetainPtr<id> converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
+ RetainPtr<QLPreviewConverter> converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
NSURLRequest *request = [converter previewRequest];
// We use [request URL] here instead of url since it will be
@@ -228,18 +181,13 @@
static Vector<char> createQLPreviewProtocol()
{
Vector<char> previewProtocol;
-#define QLPreviewScheme getQLPreviewScheme()
const char* qlPreviewScheme = [QLPreviewScheme UTF8String];
-#undef QLPreviewScheme
previewProtocol.append(qlPreviewScheme, strlen(qlPreviewScheme) + 1);
return previewProtocol;
}
const char* WebCore::QLPreviewProtocol()
{
- if (!canLoadQLPreviewScheme())
- return "";
-
static NeverDestroyed<Vector<char>> previewProtocol(createQLPreviewProtocol());
return previewProtocol.get().data();
}
@@ -459,7 +407,7 @@
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 || ![WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
+ 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));
@@ -471,7 +419,7 @@
std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
{
ASSERT_ARG(handle, handle);
- if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
+ if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
return nullptr;
NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
@@ -489,7 +437,7 @@
bool QuickLookHandle::shouldCreateForMIMEType(const String& mimeType)
{
- return [WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
+ return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
}
std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceLoader& loader, const ResourceResponse& response)
Modified: trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm (183597 => 183598)
--- trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm 2015-04-30 00:46:40 UTC (rev 183597)
+++ trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm 2015-04-30 01:18:18 UTC (rev 183598)
@@ -32,6 +32,7 @@
#import "WebCoreSystemInterface.h"
#import "QuickLook.h"
+#import "QuickLookSoftLink.h"
#import "SoftLinking.h"
#import <MobileCoreServices/MobileCoreServices.h>