<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183598] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183598">183598</a></dd>
<dt>Author</dt> <dd>ddkilzer@apple.com</dd>
<dt>Date</dt> <dd>2015-04-29 18:18:18 -0700 (Wed, 29 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Attempt #2: Switch QuickLook soft-linking to use QuickLookSoftLink.{h,mm}
&lt;http://webkit.org/b/144362&gt;

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&lt;&gt;.
(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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformmacSoftLinkingh">trunk/Source/WebCore/platform/mac/SoftLinking.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkiosQuickLookh">trunk/Source/WebCore/platform/network/ios/QuickLook.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkiosQuickLookmm">trunk/Source/WebCore/platform/network/ios/QuickLook.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkiosWebCoreURLResponseIOSmm">trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformiosQuickLookSoftLinkh">trunk/Source/WebCore/platform/ios/QuickLookSoftLink.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosQuickLookSoftLinkmm">trunk/Source/WebCore/platform/ios/QuickLookSoftLink.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183597 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2015-04-29  David Kilzer  &lt;ddkilzer@apple.com&gt;
+
+        Attempt #2: Switch QuickLook soft-linking to use QuickLookSoftLink.{h,mm}
+        &lt;http://webkit.org/b/144362&gt;
+
+        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&lt;&gt;.
+        (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.
+
</ins><span class="cx"> 2015-04-29  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Compute the non-fast-scrollable region in main-document coordinates
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (183597 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1599,7 +1599,9 @@
</span><span class="cx">                 44311CD912E4E257000A8D19 /* DOMDocumentFragmentPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 44311CD412E4E22D000A8D19 /* DOMDocumentFragmentPrivate.h */; };
</span><span class="cx">                 44311F8212E4E66C000A8D19 /* DOMDocumentFragmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 85E711450AC5D5340053270F /* DOMDocumentFragmentInternal.h */; };
</span><span class="cx">                 443817FF1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */; };
</span><ins>+                443917FF1A91B2F8006E04F2 /* QuickLookSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */; };
</ins><span class="cx">                 443818001A91B2F8006E04F2 /* CoreMediaSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */; };
</span><ins>+                443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */; };
</ins><span class="cx">                 443F04270E75C8FB007E5407 /* NetworkStateNotifierIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */; };
</span><span class="cx">                 4449A4051A964B0000B64AD5 /* CoreMediaSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 4449A4041A964B0000B64AD5 /* CoreMediaSPI.h */; };
</span><span class="cx">                 444D4E230F708B2E003158E0 /* WebCoreURLResponseIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */; };
</span><span class="lines">@@ -8764,7 +8766,9 @@
</span><span class="cx">                 44311CD412E4E22D000A8D19 /* DOMDocumentFragmentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDocumentFragmentPrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 44311CD512E4E22D000A8D19 /* DOMDocumentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDocumentPrivate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 443817FD1A91B2F8006E04F2 /* CoreMediaSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreMediaSoftLink.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ios/QuickLookSoftLink.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 443817FE1A91B2F8006E04F2 /* CoreMediaSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreMediaSoftLink.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios/QuickLookSoftLink.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 443F04260E75C8FB007E5407 /* NetworkStateNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkStateNotifierIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 4449A4041A964B0000B64AD5 /* CoreMediaSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreMediaSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponseIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -18849,6 +18853,8 @@
</span><span class="cx">                                 C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */,
</span><span class="cx">                                 E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */,
</span><span class="cx">                                 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */,
</span><ins>+                                443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */,
+                                443917FD1A91B2F8006E04F2 /* QuickLookSoftLink.mm */,
</ins><span class="cx">                                 CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */,
</span><span class="cx">                                 CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */,
</span><span class="cx">                                 44C363EE0FAA7BB30097F8CC /* RuntimeApplicationChecksIOS.h */,
</span><span class="lines">@@ -26052,6 +26058,7 @@
</span><span class="cx">                                 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */,
</span><span class="cx">                                 CE12523D1A1676CD00864480 /* QuartzCoreSPI.h in Headers */,
</span><span class="cx">                                 442AF7A9102CDDEA008FD4D3 /* QuickLook.h in Headers */,
</span><ins>+                                443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */,
</ins><span class="cx">                                 A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */,
</span><span class="cx">                                 CE1252391A166FA000864480 /* QuickLookSPI.h in Headers */,
</span><span class="cx">                                 A10DBF4718F92317000D70C6 /* QuickLookHandleClient.h in Headers */,
</span><span class="lines">@@ -29551,6 +29558,7 @@
</span><span class="cx">                                 CDEE393717974259001D7580 /* PublicURLManager.cpp in Sources */,
</span><span class="cx">                                 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */,
</span><span class="cx">                                 442AF7AA102CDDEA008FD4D3 /* QuickLook.mm in Sources */,
</span><ins>+                                443917FF1A91B2F8006E04F2 /* QuickLookSoftLink.mm in Sources */,
</ins><span class="cx">                                 072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */,
</span><span class="cx">                                 379E371613736A6600B9E919 /* QuotedPrintable.cpp in Sources */,
</span><span class="cx">                                 5A574F28131DB96D00471B88 /* QuotesData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosQuickLookSoftLinkh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/QuickLookSoftLink.h (0 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * 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 &quot;QuickLookSPI.h&quot;
+#include &quot;SoftLinking.h&quot;
+
+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)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosQuickLookSoftLinkmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/QuickLookSoftLink.mm (0 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * 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 &quot;config.h&quot;
+
+#if USE(QUICK_LOOK)
+
+#import &quot;QuickLookSPI.h&quot;
+#import &quot;SoftLinking.h&quot;
+
+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)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacSoftLinkingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/SoftLinking.h (183597 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -317,6 +317,42 @@
</span><span class="cx">     } \
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#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(&amp;once, ^{ \
+            framework##Library(); \
+            class##className = objc_getClass(#className); \
+            RELEASE_ASSERT(class##className); \
+            get_##framework##_##className##Class = className##Function; \
+        }); \
+        return class##className; \
+    } \
+    }
+
</ins><span class="cx"> #define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
</span><span class="cx">     WTF_EXTERN_C_BEGIN \
</span><span class="cx">     extern const variableType variableName; \
</span><span class="lines">@@ -374,4 +410,33 @@
</span><span class="cx">     } \
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#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(&amp;once, ^{ \
+            void** pointer = static_cast&lt;void**&gt;(dlsym(framework##Library(), #variableName)); \
+            RELEASE_ASSERT_WITH_MESSAGE(pointer, &quot;%s&quot;, dlerror()); \
+            pointer##framework##variableName = static_cast&lt;variableType&gt;(*pointer); \
+            get_##framework##_##variableName = pointer##framework##variableName##Function; \
+        }); \
+        return pointer##framework##variableName; \
+    } \
+    }
+
</ins><span class="cx"> #endif // SoftLinking_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkiosQuickLookh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.h (183597 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -57,10 +57,6 @@
</span><span class="cx"> class ResourceResponse;
</span><span class="cx"> class SynchronousResourceHandleCFURLConnectionDelegate;
</span><span class="cx"> 
</span><del>-Class QLPreviewConverterClass();
-NSString *QLTypeCopyBestMimeTypeForFileNameAndMimeType(NSString *fileName, NSString *mimeType);
-NSString *QLTypeCopyBestMimeTypeForURLAndMimeType(NSURL *, NSString *mimeType);
-
</del><span class="cx"> WEBCORE_EXPORT NSSet *QLPreviewGetSupportedMIMETypesSet();
</span><span class="cx"> 
</span><span class="cx"> // Used for setting the permissions on the saved QL content
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkiosQuickLookmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (183597 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,12 +32,11 @@
</span><span class="cx"> #import &quot;FileSystemIOS.h&quot;
</span><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;NSFileManagerSPI.h&quot;
</span><del>-#import &quot;QuickLookSPI.h&quot;
</del><ins>+#import &quot;QuickLookSoftLink.h&quot;
</ins><span class="cx"> #import &quot;ResourceError.h&quot;
</span><span class="cx"> #import &quot;ResourceHandle.h&quot;
</span><span class="cx"> #import &quot;ResourceLoader.h&quot;
</span><span class="cx"> #import &quot;RuntimeApplicationChecksIOS.h&quot;
</span><del>-#import &quot;SoftLinking.h&quot;
</del><span class="cx"> #import &quot;SynchronousResourceHandleCFURLConnectionDelegate.h&quot;
</span><span class="cx"> #import &quot;WebCoreURLResponseIOS.h&quot;
</span><span class="cx"> #import &lt;Foundation/Foundation.h&gt;
</span><span class="lines">@@ -56,60 +55,14 @@
</span><span class="cx"> @end
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-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);
-}
-
</del><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-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);
-}
-
</del><span class="cx"> NSSet *WebCore::QLPreviewGetSupportedMIMETypesSet()
</span><span class="cx"> {
</span><del>-    if (!canLoadQLPreviewGetSupportedMIMETypes())
-        return nil;
-
-    static NSSet *set = adoptNS(::QLPreviewGetSupportedMIMETypes()).leakRef();
-    return set;
</del><ins>+    static NeverDestroyed&lt;RetainPtr&lt;NSSet&gt;&gt; set = QLPreviewGetSupportedMIMETypes();
+    return set.get().get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-NSString *WebCore::QLTypeCopyUTIForURLAndMimeType(NSURL *url, NSString *mimeType)
-{
-    if (!canLoadQLTypeCopyUTIForURLAndMimeType())
-        return nil;
-
-    return ::QLTypeCopyUTIForURLAndMimeType(url, mimeType);
-}
-
</del><span class="cx"> NSDictionary *WebCore::QLFileAttributes()
</span><span class="cx"> {
</span><span class="cx">     // Set file perms to owner read/write only
</span><span class="lines">@@ -190,12 +143,12 @@
</span><span class="cx"> 
</span><span class="cx"> RetainPtr&lt;NSURLRequest&gt; WebCore::registerQLPreviewConverterIfNeeded(NSURL *url, NSString *mimeType, NSData *data)
</span><span class="cx"> {
</span><del>-    RetainPtr&lt;NSString&gt; updatedMIMEType = adoptNS(WebCore::QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
</del><ins>+    RetainPtr&lt;NSString&gt; updatedMIMEType = adoptNS(QLTypeCopyBestMimeTypeForURLAndMimeType(url, mimeType));
</ins><span class="cx"> 
</span><del>-    if ([WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
-        RetainPtr&lt;NSString&gt; uti = adoptNS(WebCore::QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
</del><ins>+    if ([QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
+        RetainPtr&lt;NSString&gt; uti = adoptNS(QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
</ins><span class="cx"> 
</span><del>-        RetainPtr&lt;id&gt; converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
</del><ins>+        RetainPtr&lt;QLPreviewConverter&gt; converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
</ins><span class="cx">         NSURLRequest *request = [converter previewRequest];
</span><span class="cx"> 
</span><span class="cx">         // We use [request URL] here instead of url since it will be
</span><span class="lines">@@ -228,18 +181,13 @@
</span><span class="cx"> static Vector&lt;char&gt; createQLPreviewProtocol()
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;char&gt; previewProtocol;
</span><del>-#define QLPreviewScheme getQLPreviewScheme()
</del><span class="cx">     const char* qlPreviewScheme = [QLPreviewScheme UTF8String];
</span><del>-#undef QLPreviewScheme
</del><span class="cx">     previewProtocol.append(qlPreviewScheme, strlen(qlPreviewScheme) + 1);
</span><span class="cx">     return previewProtocol;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const char* WebCore::QLPreviewProtocol()
</span><span class="cx"> {
</span><del>-    if (!canLoadQLPreviewScheme())
-        return &quot;&quot;;
-
</del><span class="cx">     static NeverDestroyed&lt;Vector&lt;char&gt;&gt; previewProtocol(createQLPreviewProtocol());
</span><span class="cx">     return previewProtocol.get().data();
</span><span class="cx"> }
</span><span class="lines">@@ -459,7 +407,7 @@
</span><span class="cx"> std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceHandle* handle, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(handle, handle);
</span><del>-    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
</del><ins>+    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:[nsResponse MIMEType]])
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;QuickLookHandle&gt; quickLookHandle(new QuickLookHandle([handle-&gt;firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], connection, nsResponse, delegate));
</span><span class="lines">@@ -471,7 +419,7 @@
</span><span class="cx"> std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(handle, handle);
</span><del>-    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
</del><ins>+    if (handle-&gt;firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
</span><span class="lines">@@ -489,7 +437,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool QuickLookHandle::shouldCreateForMIMEType(const String&amp; mimeType)
</span><span class="cx"> {
</span><del>-    return [WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
</del><ins>+    return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;QuickLookHandle&gt; QuickLookHandle::create(ResourceLoader&amp; loader, const ResourceResponse&amp; response)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkiosWebCoreURLResponseIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.mm (183597 => 183598)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;QuickLook.h&quot;
</span><ins>+#import &quot;QuickLookSoftLink.h&quot;
</ins><span class="cx"> #import &quot;SoftLinking.h&quot;
</span><span class="cx"> #import &lt;MobileCoreServices/MobileCoreServices.h&gt;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>