<!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>[215247] trunk</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/215247">215247</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2017-04-11 12:13:23 -0700 (Tue, 11 Apr 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] WebKit unnecessarily soft-links CorePrediction
https://bugs.webkit.org/show_bug.cgi?id=170644

Reviewed by Sam Weinig.

Source/WebKit2:

* Configurations/BaseTarget.xcconfig: Defined HAVE_CORE_PREDICTION and added
  HAVE_CORE_PREDICTION to the preprocessor defintions when the former is YES.

* Configurations/WebKit.xcconfig: Have the linker link against CorePrediction where
  available. On macOS, use weak linking, because CorePrediction is not available in the
  Base System.

* Platform/classifier/cocoa/CorePredictionSoftLink.h: Removed.

* Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Guarded with
  #if HAVE(CORE_PREDICTION).
(WebKit::isNullFunctionPointer): Added this helper.
(WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Replaced
  dlopen()-based runtime check with a null check.

* Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Guarded with #if
  HAVE(CORE_PREDICTION).

* Platform/spi/Cocoa/CorePredictionSPI.h: Added.

* UIProcess/WebResourceLoadStatisticsStore.h: Updated guards to include HAVE(CORE_PREDICTION).

* WebKit2.xcodeproj/project.pbxproj: pdated file references for removal and addition.

WebKitLibraries:

* WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework: Added this framework stub.
* WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2ConfigurationsBaseTargetxcconfig">trunk/Source/WebKit2/Configurations/BaseTarget.xcconfig</a></li>
<li><a href="#trunkSourceWebKit2ConfigurationsWebKitxcconfig">trunk/Source/WebKit2/Configurations/WebKit.xcconfig</a></li>
<li><a href="#trunkSourceWebKit2PlatformclassifiercocoaResourceLoadStatisticsClassifierCocoacpp">trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp</a></li>
<li><a href="#trunkSourceWebKit2PlatformclassifiercocoaResourceLoadStatisticsClassifierCocoah">trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStoreh">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkWebKitLibrariesChangeLog">trunk/WebKitLibraries/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2PlatformspiCocoaCorePredictionSPIh">trunk/Source/WebKit2/Platform/spi/Cocoa/CorePredictionSPI.h</a></li>
<li>trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/</li>
<li><a href="#trunkWebKitLibrariesWebKitPrivateFrameworkStubsiOS10CorePredictionframeworkCorePredictiontbd">trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2PlatformclassifiercocoaCorePredictionSoftLinkh">trunk/Source/WebKit2/Platform/classifier/cocoa/CorePredictionSoftLink.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/ChangeLog        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2017-04-11  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        [Cocoa] WebKit unnecessarily soft-links CorePrediction
+        https://bugs.webkit.org/show_bug.cgi?id=170644
+
+        Reviewed by Sam Weinig.
+
+        * Configurations/BaseTarget.xcconfig: Defined HAVE_CORE_PREDICTION and added
+          HAVE_CORE_PREDICTION to the preprocessor defintions when the former is YES.
+
+        * Configurations/WebKit.xcconfig: Have the linker link against CorePrediction where
+          available. On macOS, use weak linking, because CorePrediction is not available in the
+          Base System.
+
+        * Platform/classifier/cocoa/CorePredictionSoftLink.h: Removed.
+
+        * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Guarded with
+          #if HAVE(CORE_PREDICTION).
+        (WebKit::isNullFunctionPointer): Added this helper.
+        (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Replaced
+          dlopen()-based runtime check with a null check.
+
+        * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Guarded with #if
+          HAVE(CORE_PREDICTION).
+
+        * Platform/spi/Cocoa/CorePredictionSPI.h: Added.
+
+        * UIProcess/WebResourceLoadStatisticsStore.h: Updated guards to include HAVE(CORE_PREDICTION).
+
+        * WebKit2.xcodeproj/project.pbxproj: pdated file references for removal and addition.
+
</ins><span class="cx"> 2017-04-11  David Quesada  &lt;david_quesada@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add SPI for handling geolocation authorization requests
</span></span></pre></div>
<a id="trunkSourceWebKit2ConfigurationsBaseTargetxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Configurations/BaseTarget.xcconfig (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Configurations/BaseTarget.xcconfig        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/Configurations/BaseTarget.xcconfig        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_base);
</span><span class="cx"> 
</span><span class="cx"> GCC_PREFIX_HEADER = WebKit2Prefix.h;
</span><del>-GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) $(WK_MANUAL_SANDBOXING_DEFINES) FRAMEWORK_NAME=WebKit;
</del><ins>+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) $(WK_MANUAL_SANDBOXING_DEFINES) $(WK_CORE_PREDICTION_DEFINES) FRAMEWORK_NAME=WebKit;
</ins><span class="cx"> WEBKITADDITIONS_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions $(SDKROOT)/usr/local/include/WebKitAdditions;
</span><span class="cx"> HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include &quot;$(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders&quot; &quot;$(WEBCORE_PRIVATE_HEADERS_DIR)/icu&quot; $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2 $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) $(HEADER_SEARCH_PATHS);
</span><span class="cx"> 
</span><span class="lines">@@ -105,3 +105,9 @@
</span><span class="cx"> 
</span><span class="cx"> WK_OVERRIDE_FRAMEWORKS_DIR = $(WK_OVERRIDE_FRAMEWORKS_DIR_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH));
</span><span class="cx"> WK_OVERRIDE_FRAMEWORKS_DIR_USE_STAGING_INSTALL_PATH_YES = $(SYSTEM_LIBRARY_DIR)/StagedFrameworks/Safari;
</span><ins>+
+WK_HAVE_CORE_PREDICTION = YES;
+WK_HAVE_CORE_PREDICTION[sdk=macosx*][arch=i386] = NO;
+
+WK_CORE_PREDICTION_DEFINES = $(WK_CORE_PREDICTION_DEFINES_$(WK_HAVE_CORE_PREDICTION));
+WK_CORE_PREDICTION_DEFINES_YES = HAVE_CORE_PREDICTION;
</ins></span></pre></div>
<a id="trunkSourceWebKit2ConfigurationsWebKitxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Configurations/WebKit.xcconfig (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Configurations/WebKit.xcconfig        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/Configurations/WebKit.xcconfig        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Versions/A/Frameworks;
</span><span class="cx"> LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
</span><span class="cx"> 
</span><del>-OTHER_LDFLAGS = $(inherited) $(UNEXPORTED_SYMBOL_LDFLAGS) $(ASAN_OTHER_LDFLAGS) $(FRAMEWORK_AND_LIBRARY_LDFLAGS) $(OTHER_LDFLAGS_PLATFORM) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) -framework WebKitLegacy;
</del><ins>+OTHER_LDFLAGS = $(inherited) -F&quot;$(SDK_DIR)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks&quot; $(UNEXPORTED_SYMBOL_LDFLAGS) $(ASAN_OTHER_LDFLAGS) $(FRAMEWORK_AND_LIBRARY_LDFLAGS) $(OTHER_LDFLAGS_PLATFORM) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) -framework WebKitLegacy;
</ins><span class="cx"> OTHER_LDFLAGS_PLATFORM[sdk=macosx*] = $(LIBWEBRTC_LDFLAGS);
</span><span class="cx"> OTHER_LDFLAGS_PLATFORM[sdk=iphoneos*] = -lAccessibility $(LIBWEBRTC_LDFLAGS);
</span><span class="cx"> OTHER_LDFLAGS_PLATFORM[sdk=iphonesimulator*] = -lAccessibility $(LIBWEBRTC_LDFLAGS);
</span><span class="lines">@@ -83,3 +83,7 @@
</span><span class="cx"> 
</span><span class="cx"> WK_RELOCATABLE_FRAMEWORK_LDFLAGS = $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS_$(WK_RELOCATABLE_FRAMEWORKS));
</span><span class="cx"> WK_RELOCATABLE_FRAMEWORK_LDFLAGS_YES = -Wl,-not_for_dyld_shared_cache;
</span><ins>+
+WK_CORE_PREDICTION_LDFLAGS = $(WK_CORE_PREDICTION_LDFLAGS_$(WK_HAVE_CORE_PREDICTION));
+WK_CORE_PREDICTION_LDFLAGS_YES = -framework CorePrediction;
+WK_CORE_PREDICTION_LDFLAGS_YES[sdk=macosx*] = -weak_framework CorePrediction;
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformclassifiercocoaCorePredictionSoftLinkh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/Platform/classifier/cocoa/CorePredictionSoftLink.h (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/classifier/cocoa/CorePredictionSoftLink.h        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/Platform/classifier/cocoa/CorePredictionSoftLink.h        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -1,38 +0,0 @@
</span><del>-/*
- * Copyright (C) 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
- * 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.
- */
-
-#pragma once
-
-#include &lt;WebCore/SoftLinking.h&gt;
-
-struct svm_model;
-struct svm_node {
-    int index;
-    double value;
-};
-
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(CorePrediction)
-SOFT_LINK(CorePrediction, svm_predict_values, double, (const struct svm_model *model, const struct svm_node *x, double* dec_values), (model, x, dec_values))
-SOFT_LINK(CorePrediction, svm_load_model, svm_model*, (const char *model_file_name), (model_file_name))
</del></span></pre></div>
<a id="trunkSourceWebKit2PlatformclassifiercocoaResourceLoadStatisticsClassifierCocoacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -26,9 +26,11 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ResourceLoadStatisticsClassifierCocoa.h&quot;
</span><span class="cx"> 
</span><ins>+#if HAVE(CORE_PREDICTION)
+
+#include &quot;CorePredictionSPI.h&quot;
</ins><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><del>-#include &quot;CorePredictionSoftLink.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="lines">@@ -70,6 +72,20 @@
</span><span class="cx">     return String(resourceUrlString.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool isNullFunctionPointer(void* functionPointer)
+{
+    void* result;
+    // The C compiler may take advantage of the fact that by definition, function pointers cannot be
+    // null. When weak-linking a library, function pointers can be null. We use non-C code to
+    // prevent the C compiler from using the definition to optimize out the null check.
+    asm(
+        &quot;mov %1, %0&quot;
+        : &quot;=r&quot; (result)
+        : &quot;r&quot; (functionPointer)
+    );
+    return !result;
+}
+
</ins><span class="cx"> bool ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction()
</span><span class="cx"> {
</span><span class="cx">     if (m_haveLoadedModel)
</span><span class="lines">@@ -78,7 +94,7 @@
</span><span class="cx">     if (!m_useCorePrediction)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!CorePredictionLibrary()) {
</del><ins>+    if (isNullFunctionPointer(reinterpret_cast&lt;void*&gt;(svm_load_model))) {
</ins><span class="cx">         m_useCorePrediction = false;
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="lines">@@ -110,3 +126,5 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformclassifiercocoaResourceLoadStatisticsClassifierCocoah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -25,6 +25,8 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#if HAVE(CORE_PREDICTION)
+
</ins><span class="cx"> #include &quot;ResourceLoadStatisticsClassifier.h&quot;
</span><span class="cx"> #include &lt;wtf/Platform.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -44,3 +46,5 @@
</span><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> }
</span><ins>+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformspiCocoaCorePredictionSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Platform/spi/Cocoa/CorePredictionSPI.h (0 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/spi/Cocoa/CorePredictionSPI.h                                (rev 0)
+++ trunk/Source/WebKit2/Platform/spi/Cocoa/CorePredictionSPI.h        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 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
+ * 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.
+ */
+
+#pragma once
+
+#if HAVE(CORE_PREDICTION)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import &lt;CorePrediction/svm.h&gt;
+
+#else
+
+struct svm_node
+{
+    int index;
+    double value;
+};
+
+#endif
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+typedef struct svm_node svm_node;
+
+struct svm_model *svm_load_model(const char *model_file_name);
+double svm_predict_values(const struct svm_model *model, const struct svm_node *x, double* dec_values);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(COCOA)
</del><ins>+#if HAVE(CORE_PREDICTION)
</ins><span class="cx"> #include &quot;ResourceLoadStatisticsClassifierCocoa.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx">     std::unique_ptr&lt;WebCore::KeyedDecoder&gt; createDecoderFromDisk(const String&amp; label) const;
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;WebCore::ResourceLoadStatisticsStore&gt; m_resourceLoadStatisticsStore;
</span><del>-#if PLATFORM(COCOA)
</del><ins>+#if HAVE(CORE_PREDICTION)
</ins><span class="cx">     ResourceLoadStatisticsClassifierCocoa m_resourceLoadStatisticsClassifier;
</span><span class="cx"> #else
</span><span class="cx">     ResourceLoadStatisticsClassifier m_resourceLoadStatisticsClassifier;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -850,6 +850,7 @@
</span><span class="cx">                 37BEC4E119491486008B4286 /* CompletionHandlerCallChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 37BEC4DF19491486008B4286 /* CompletionHandlerCallChecker.h */; };
</span><span class="cx">                 37BF2F061947DEB400723C48 /* WKNSURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 37BF2F041947DEB400723C48 /* WKNSURLRequest.h */; };
</span><span class="cx">                 37BF2F071947DEB400723C48 /* WKNSURLRequest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BF2F051947DEB400723C48 /* WKNSURLRequest.mm */; };
</span><ins>+                37C21CAE1E994C0C0029D5F9 /* CorePredictionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C21CAD1E994C0C0029D5F9 /* CorePredictionSPI.h */; };
</ins><span class="cx">                 37C4C08618149C5B003688B9 /* WKBackForwardListItem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C4C08418149C5B003688B9 /* WKBackForwardListItem.mm */; };
</span><span class="cx">                 37C4C08718149C5B003688B9 /* WKBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C4C08518149C5B003688B9 /* WKBackForwardListItem.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 37C4C08918149F23003688B9 /* WKBackForwardListItemInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */; };
</span><span class="lines">@@ -1178,7 +1179,6 @@
</span><span class="cx">                 6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */; };
</span><span class="cx">                 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; };
</span><span class="cx">                 65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                6B2E09BA1E57B88100C8A8B9 /* CorePredictionSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B2E09B91E57B88100C8A8B9 /* CorePredictionSoftLink.h */; };
</del><span class="cx">                 6BE9699C1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 6BE9699E1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */; };
</span><span class="cx">                 6BE969A01E43B86E008B7483 /* WebResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */; };
</span><span class="lines">@@ -3056,6 +3056,7 @@
</span><span class="cx">                 37BEC4DF19491486008B4286 /* CompletionHandlerCallChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompletionHandlerCallChecker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37BF2F041947DEB400723C48 /* WKNSURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSURLRequest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37BF2F051947DEB400723C48 /* WKNSURLRequest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSURLRequest.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                37C21CAD1E994C0C0029D5F9 /* CorePredictionSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePredictionSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 37C4C08418149C5B003688B9 /* WKBackForwardListItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKBackForwardListItem.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37C4C08518149C5B003688B9 /* WKBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItem.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItemInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3443,7 +3444,6 @@
</span><span class="cx">                 6546A82A13000164000CEB1C /* InjectedBundlePageResourceLoadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageResourceLoadClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                6B2E09B91E57B88100C8A8B9 /* CorePredictionSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePredictionSoftLink.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKResourceLoadStatisticsManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKResourceLoadStatisticsManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5492,6 +5492,7 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 1A5705101BE410E500874AF1 /* BlockSPI.h */,
</span><ins>+                                37C21CAD1E994C0C0029D5F9 /* CorePredictionSPI.h */,
</ins><span class="cx">                                 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */,
</span><span class="cx">                                 37B47E2C1D64DB76005F4EFF /* objcSPI.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -6311,7 +6312,6 @@
</span><span class="cx">                 6BE969C31E54D467008B7483 /* cocoa */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                6B2E09B91E57B88100C8A8B9 /* CorePredictionSoftLink.h */,
</del><span class="cx">                                 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */,
</span><span class="cx">                                 6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -8239,7 +8239,6 @@
</span><span class="cx">                                 5106D7C418BDBE73000AB166 /* ContextMenuContextData.h in Headers */,
</span><span class="cx">                                 CDC3830C17212282008A2FC3 /* CookieStorageShimLibrary.h in Headers */,
</span><span class="cx">                                 CE1A0BD31A48E6C60054EF74 /* CorePDFSPI.h in Headers */,
</span><del>-                                6B2E09BA1E57B88100C8A8B9 /* CorePredictionSoftLink.h in Headers */,
</del><span class="cx">                                 B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
</span><span class="cx">                                 515E772C184008B90007203F /* DatabaseProcessCreationParameters.h in Headers */,
</span><span class="cx">                                 512A9761180E031D0039A149 /* DatabaseProcessMessages.h in Headers */,
</span><span class="lines">@@ -8268,6 +8267,7 @@
</span><span class="cx">                                 BC032DA810F437D10058C15A /* Encoder.h in Headers */,
</span><span class="cx">                                 51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */,
</span><span class="cx">                                 1AA575FB1496B52600A4EE06 /* EventDispatcher.h in Headers */,
</span><ins>+                                37C21CAE1E994C0C0029D5F9 /* CorePredictionSPI.h in Headers */,
</ins><span class="cx">                                 00B9661A18E25AE100CE1F88 /* FindClient.h in Headers */,
</span><span class="cx">                                 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */,
</span><span class="cx">                                 BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
</span></span></pre></div>
<a id="trunkWebKitLibrariesChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/ChangeLog (215246 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/ChangeLog        2017-04-11 18:43:46 UTC (rev 215246)
+++ trunk/WebKitLibraries/ChangeLog        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-04-11  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        [Cocoa] WebKit unnecessarily soft-links CorePrediction
+        https://bugs.webkit.org/show_bug.cgi?id=170644
+
+        Reviewed by Sam Weinig.
+
+        * WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework: Added this framework stub.
+        * WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd: Added.
+
</ins><span class="cx"> 2017-04-08  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Removed an empty directory left behind after r212841.
</span></span></pre></div>
<a id="trunkWebKitLibrariesWebKitPrivateFrameworkStubsiOS10CorePredictionframeworkCorePredictiontbd"></a>
<div class="addfile"><h4>Added: trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd (0 => 215247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd                                (rev 0)
+++ trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd        2017-04-11 19:13:23 UTC (rev 215247)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+--- !tapi-tbd-v2
+archs:
+  - armv7
+  - armv7s
+  - arm64
+exports:
+  -
+    archs:
+      - armv7
+      - armv7s
+      - arm64
+    symbols:
+      - _svm_load_model
+      - _svm_predict_values
+install-name: /System/Library/PrivateFrameworks/CorePrediction.framework
+objc-constraint: none
+platform: ios
+...
</ins></span></pre>
</div>
</div>

</body>
</html>