Resource Load Statistics: Add alternate classification method
[WebKit-https.git] / Source / WebKit2 / ChangeLog
index 7858532..ae2dc94 100644 (file)
@@ -1,3 +1,79 @@
+2017-02-21  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Add alternate classification method
+        https://bugs.webkit.org/show_bug.cgi?id=168347
+        <rdar://problem/30352793>
+
+        Reviewed by Alex Christensen.
+
+        This patch adds a CorePrediction-based classifier to the WebResourceLoadStatisticsStore.
+        The CorePrediction framework is introduced as a dependency for macOS and iOS. The patch
+        also adds functions to support layout tests of the feature.
+
+        * Configurations/BaseTarget.xcconfig:
+        * Configurations/WebKit.xcconfig:
+            Added dependency on CorePrediction.
+        * Platform/classifier: Added.
+        * Platform/classifier/ResourceLoadStatisticsClassifier.h: Added.
+            Pulls in the Cocoa-specific classifier for Cocoa-based platforms.
+        (WebKit::ResourceLoadStatisticsClassifier::ResourceLoadStatisticsClassifier):
+        * Platform/classifier/ResourceLoadStatisticsClassifierBase.cpp: Added.
+        (WebKit::ResourceLoadStatisticsClassifierBase::hasPrevalentResourceCharacteristics):
+            Shared classifier logic.
+        (WebKit::ResourceLoadStatisticsClassifierBase::classifyWithVectorThreshold):
+            Fallback classifier for when we don't have CorePrediction.
+        * Platform/classifier/ResourceLoadStatisticsClassifierBase.h: Added.
+        (WebKit::ResourceLoadStatisticsClassifierBase::ResourceLoadStatisticsClassifierBase):
+        (WebKit::ResourceLoadStatisticsClassifierBase::~ResourceLoadStatisticsClassifierBase):
+        * Platform/classifier/cocoa: Added.
+        * Platform/classifier/cocoa/CorePredictionSPI.h: Added.
+            Includes CorePrediction if available, otherwise declares needed symbols.
+            Always redeclares the functions so we'll get a build error if
+            CorePrediction changes.
+        * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Added.
+        (WebKit::ResourceLoadStatisticsClassifier::classify):
+        (WebKit::ResourceLoadStatisticsClassifier::storagePath):
+        (WebKit::ResourceLoadStatisticsClassifier::shouldUseCorePrediction):
+            The new classifier for Cocoa platforms.
+        * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Added.
+        (WebKit::ResourceLoadStatisticsClassifier::ResourceLoadStatisticsClassifier):
+        * PlatformGTK.cmake:
+           Added Platform/classifier directory and ResourceLoadStatisticsClassifierBase.cpp.
+        * PlatformMac.cmake:
+           Added Platform/classifier and Platform/classifier/cocoa directories, and
+           source files ResourceLoadStatisticsClassifierBase.cpp and
+           ResourceLoadStatisticsClassifierCocoa.cpp
+        * Resources/ResourceLoadStatistics: Added.
+        * Resources/ResourceLoadStatistics/corePrediction_model: Added.
+            Model file to load into CorePrediction.
+        * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
+        (WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin):
+        (WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin):
+        (WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo):
+            Test infrastructure.
+        * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
+        * UIProcess/WebResourceLoadStatisticsManager.cpp:
+        (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
+        (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
+        (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
+            Test infrastructure.
+        * UIProcess/WebResourceLoadStatisticsManager.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
+            Renamed m_storagePath to m_statisticsStoragePath for clarity.
+        (WebKit::WebResourceLoadStatisticsStore::classifyResource):
+            Now calls the classifier through its ResourceLoadStatisticsClassifier
+            member variable.
+        (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath):
+            Renamed m_storagePath to m_statisticsStoragePath for clarity.
+        (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
+            Renamed m_storagePath to m_statisticsStoragePath for clarity.
+        (WebKit::WebResourceLoadStatisticsStore::hasPrevalentResourceCharacteristics): Deleted.
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+            Added the new classifier source files under Platform/classifier and the
+            corePrediction_model file under Resources/ResourceLoadStatistics.
+
 2017-02-21  Alex Christensen  <achristensen@webkit.org>
 
         Fix CMake build.
 2017-02-21  Alex Christensen  <achristensen@webkit.org>
 
         Fix CMake build.