Changeset 212757 in webkit
- Timestamp:
- Feb 21, 2017 2:40:28 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 24 added
- 28 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r212748 r212757 1 2017-02-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Add alternate classification method 4 https://bugs.webkit.org/show_bug.cgi?id=168347 5 <rdar://problem/30352793> 6 7 Reviewed by Alex Christensen. 8 9 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-expected.txt: Added. 10 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html: Added. 11 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-expected.txt: Added. 12 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html: Added. 13 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins-expected.txt: Added. 14 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html: Added. 15 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to-expected.txt: Added. 16 * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html: Added. 17 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics-expected.txt: Added. 18 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html: Added. 19 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins-expected.txt: Added. 20 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html: Added. 21 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins-expected.txt: Added. 22 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html: Added. 23 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to-expected.txt: Added. 24 * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html: Added. 25 * platform/gtk/TestExpectations: 26 The whole http/tests/loading/resourceLoadStatistics marked as crashing based on 27 Carlos Garcia Campos's assessment in https://bugs.webkit.org/show_bug.cgi?id=168171. 28 * platform/wk2/TestExpectations: 29 The above tests are only valid for WebKit2. Marked as [ Pass ]. 30 1 31 2017-02-21 Romain Bellessort <romain.bellessort@crf.canon.fr> 2 32 -
trunk/LayoutTests/platform/gtk/TestExpectations
r212704 r212757 932 932 webkit.org/b/163782 media/video-played-ranges-1.html [ Crash Pass ] 933 933 934 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html [ Crash ] 935 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html [ Crash ] 936 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html [ Crash ] 937 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html [ Crash ] 938 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html [ Crash ] 934 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics [ Crash ] 939 935 940 936 webkit.org/b/167576 imported/w3c/IndexedDB-private-browsing/idbcursor_iterating.html [ Crash ] -
trunk/LayoutTests/platform/wk2/TestExpectations
r212691 r212757 706 706 http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html [ Pass Timeout ] 707 707 http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html [ Pass Timeout ] 708 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html [ Pass ] 709 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html [ Pass ] 710 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html [ Pass ] 711 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html [ Pass ] 712 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html [ Pass ] 713 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html [ Pass ] 714 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html [ Pass ] 715 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html [ Pass ] 708 716 709 717 ### END OF (5) Progressions, expected successes that are expected failures in WebKit1. -
trunk/Source/WTF/ChangeLog
r212704 r212757 1 2017-02-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Add alternate classification method 4 https://bugs.webkit.org/show_bug.cgi?id=168347 5 <rdar://problem/30352793> 6 7 Reviewed by Alex Christensen. 8 9 * wtf/Platform.h: 10 Added support for HAVE(CORE_PREDICTION). 11 1 12 2017-02-21 Alex Christensen <achristensen@webkit.org> 2 13 -
trunk/Source/WTF/wtf/Platform.h
r212704 r212757 1209 1209 #endif /* PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 */ 1210 1210 1211 /* CorePrediction only exists on 64-bit platforms. */ 1212 #if USE(JSVALUE64) && (PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)) 1213 #define HAVE_CORE_PREDICTION 1 1214 #endif 1215 1211 1216 #endif /* WTF_Platform_h */ -
trunk/Source/WebCore/ChangeLog
r212756 r212757 1 2017-02-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Add alternate classification method 4 https://bugs.webkit.org/show_bug.cgi?id=168347 5 <rdar://problem/30352793> 6 7 Reviewed by Alex Christensen. 8 9 This patch only adds test infrastructure in WebCore. 10 11 Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html 12 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html 13 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html 14 http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html 15 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html 16 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html 17 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html 18 http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html 19 20 * loader/ResourceLoadObserver.cpp: 21 (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin): 22 (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin): 23 (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo): 24 * loader/ResourceLoadObserver.h: 25 1 26 2017-02-21 Alex Christensen <achristensen@webkit.org> 2 27 -
trunk/Source/WebCore/loader/ResourceLoadObserver.cpp
r212691 r212757 376 376 } 377 377 378 void ResourceLoadObserver::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame) 379 { 380 if (subframe.isBlankURL() || subframe.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty()) 381 return; 382 383 auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(subframe)); 384 statistics.subframeUnderTopFrameOrigins.add(primaryDomain(topFrame)); 385 } 386 387 void ResourceLoadObserver::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame) 388 { 389 if (subresource.isBlankURL() || subresource.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty()) 390 return; 391 392 auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(subresource)); 393 statistics.subresourceUnderTopFrameOrigins.add(primaryDomain(topFrame)); 394 } 395 396 void ResourceLoadObserver::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo) 397 { 398 if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty()) 399 return; 400 401 auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(subresource)); 402 statistics.subresourceUniqueRedirectsTo.add(primaryDomain(hostNameRedirectedTo)); 403 } 404 378 405 void ResourceLoadObserver::setTimeToLiveUserInteraction(double seconds) 379 406 { -
trunk/Source/WebCore/loader/ResourceLoadObserver.h
r212691 r212757 59 59 WEBCORE_EXPORT void clearPrevalentResource(const URL&); 60 60 61 WEBCORE_EXPORT void setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame); 62 WEBCORE_EXPORT void setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame); 63 WEBCORE_EXPORT void setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo); 64 61 65 WEBCORE_EXPORT void setTimeToLiveUserInteraction(double seconds); 62 66 WEBCORE_EXPORT void setReducedTimestampResolution(double seconds); -
trunk/Source/WebKit2/ChangeLog
r212756 r212757 1 2017-02-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Add alternate classification method 4 https://bugs.webkit.org/show_bug.cgi?id=168347 5 <rdar://problem/30352793> 6 7 Reviewed by Alex Christensen. 8 9 This patch adds a CorePrediction-based classifier to the WebResourceLoadStatisticsStore. 10 The CorePrediction framework is introduced as a dependency for macOS and iOS. The patch 11 also adds functions to support layout tests of the feature. 12 13 * Configurations/BaseTarget.xcconfig: 14 * Configurations/WebKit.xcconfig: 15 Added dependency on CorePrediction. 16 * Platform/classifier: Added. 17 * Platform/classifier/ResourceLoadStatisticsClassifier.h: Added. 18 Pulls in the Cocoa-specific classifier for Cocoa-based platforms. 19 (WebKit::ResourceLoadStatisticsClassifier::ResourceLoadStatisticsClassifier): 20 * Platform/classifier/ResourceLoadStatisticsClassifierBase.cpp: Added. 21 (WebKit::ResourceLoadStatisticsClassifierBase::hasPrevalentResourceCharacteristics): 22 Shared classifier logic. 23 (WebKit::ResourceLoadStatisticsClassifierBase::classifyWithVectorThreshold): 24 Fallback classifier for when we don't have CorePrediction. 25 * Platform/classifier/ResourceLoadStatisticsClassifierBase.h: Added. 26 (WebKit::ResourceLoadStatisticsClassifierBase::ResourceLoadStatisticsClassifierBase): 27 (WebKit::ResourceLoadStatisticsClassifierBase::~ResourceLoadStatisticsClassifierBase): 28 * Platform/classifier/cocoa: Added. 29 * Platform/classifier/cocoa/CorePredictionSPI.h: Added. 30 Includes CorePrediction if available, otherwise declares needed symbols. 31 Always redeclares the functions so we'll get a build error if 32 CorePrediction changes. 33 * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Added. 34 (WebKit::ResourceLoadStatisticsClassifier::classify): 35 (WebKit::ResourceLoadStatisticsClassifier::storagePath): 36 (WebKit::ResourceLoadStatisticsClassifier::shouldUseCorePrediction): 37 The new classifier for Cocoa platforms. 38 * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Added. 39 (WebKit::ResourceLoadStatisticsClassifier::ResourceLoadStatisticsClassifier): 40 * PlatformGTK.cmake: 41 Added Platform/classifier directory and ResourceLoadStatisticsClassifierBase.cpp. 42 * PlatformMac.cmake: 43 Added Platform/classifier and Platform/classifier/cocoa directories, and 44 source files ResourceLoadStatisticsClassifierBase.cpp and 45 ResourceLoadStatisticsClassifierCocoa.cpp 46 * Resources/ResourceLoadStatistics: Added. 47 * Resources/ResourceLoadStatistics/corePrediction_model: Added. 48 Model file to load into CorePrediction. 49 * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp: 50 (WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin): 51 (WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin): 52 (WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo): 53 Test infrastructure. 54 * UIProcess/API/C/WKResourceLoadStatisticsManager.h: 55 * UIProcess/WebResourceLoadStatisticsManager.cpp: 56 (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin): 57 (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin): 58 (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo): 59 Test infrastructure. 60 * UIProcess/WebResourceLoadStatisticsManager.h: 61 * UIProcess/WebResourceLoadStatisticsStore.cpp: 62 (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): 63 Renamed m_storagePath to m_statisticsStoragePath for clarity. 64 (WebKit::WebResourceLoadStatisticsStore::classifyResource): 65 Now calls the classifier through its ResourceLoadStatisticsClassifier 66 member variable. 67 (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): 68 Renamed m_storagePath to m_statisticsStoragePath for clarity. 69 (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): 70 Renamed m_storagePath to m_statisticsStoragePath for clarity. 71 (WebKit::WebResourceLoadStatisticsStore::hasPrevalentResourceCharacteristics): Deleted. 72 * UIProcess/WebResourceLoadStatisticsStore.h: 73 * WebKit2.xcodeproj/project.pbxproj: 74 Added the new classifier source files under Platform/classifier and the 75 corePrediction_model file under Resources/ResourceLoadStatistics. 76 1 77 2017-02-21 Alex Christensen <achristensen@webkit.org> 2 78 -
trunk/Source/WebKit2/Configurations/BaseTarget.xcconfig
r212691 r212757 33 33 WK_PRIVATE_FRAMEWORKS_DIR_iphoneos_NO = $(PRODUCTION_FRAMEWORKS_DIR); 34 34 35 FRAMEWORK_SEARCH_PATHS_base = "$(UMBRELLA_FRAMEWORKS_DIR)" $(FRAMEWORK_SEARCH_PATHS);35 FRAMEWORK_SEARCH_PATHS_base = "$(UMBRELLA_FRAMEWORKS_DIR)" /System/Library/PrivateFrameworks $(FRAMEWORK_SEARCH_PATHS); 36 36 FRAMEWORK_SEARCH_PATHS[sdk=iphone*] = $(FRAMEWORK_SEARCH_PATHS_base) $(WK_PRIVATE_FRAMEWORKS_DIR); 37 37 FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_base); -
trunk/Source/WebKit2/Configurations/WebKit.xcconfig
r212704 r212757 35 35 DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT_FRAMEWORKS_DIR); 36 36 37 FRAMEWORK_AND_LIBRARY_LDFLAGS_BASE_ios = -lobjc -framework AssertionServices -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CorePDF -framework Core Text -framework Foundation -framework GraphicsServices -framework ImageIO -framework UIKit -framework OpenGLES -framework MobileCoreServices -lMobileGestalt $(FRAMEWORK_AND_LIBRARY_LDFLAGS_PLATFORM_$(PLATFORM_NAME));37 FRAMEWORK_AND_LIBRARY_LDFLAGS_BASE_ios = -lobjc -framework AssertionServices -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CorePDF -framework CorePrediction -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework UIKit -framework OpenGLES -framework MobileCoreServices -lMobileGestalt $(FRAMEWORK_AND_LIBRARY_LDFLAGS_PLATFORM_$(PLATFORM_NAME)); 38 38 FRAMEWORK_AND_LIBRARY_LDFLAGS[sdk=iphoneos*] = $(FRAMEWORK_AND_LIBRARY_LDFLAGS_BASE_ios) -framework IOSurface; 39 39 FRAMEWORK_AND_LIBRARY_LDFLAGS[sdk=iphonesimulator*] = $(FRAMEWORK_AND_LIBRARY_LDFLAGS_BASE_ios); 40 40 FRAMEWORK_AND_LIBRARY_LDFLAGS_PLATFORM_iphoneos = ; 41 41 FRAMEWORK_AND_LIBRARY_LDFLAGS_PLATFORM_iphonesimulator = ; 42 FRAMEWORK_AND_LIBRARY_LDFLAGS[sdk=macosx*] = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework CoreAudio -framework IOSurface -framework OpenGL; 42 FRAMEWORK_AND_LIBRARY_LDFLAGS[sdk=macosx*] = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework CoreAudio -framework IOSurface -framework OpenGL $(EXTRA_FRAMEWORK_AND_LIBRARY_LDFLAGS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); 43 EXTRA_FRAMEWORK_AND_LIBRARY_LDFLAGS_101200 = -framework CorePrediction; 44 EXTRA_FRAMEWORK_AND_LIBRARY_LDFLAGS_101300 = -framework CorePrediction; 43 45 44 46 // Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols. -
trunk/Source/WebKit2/Platform/classifier/ResourceLoadStatisticsClassifier.h
r212756 r212757 26 26 #pragma once 27 27 28 #include "APIObject.h"28 #include <wtf/Platform.h> 29 29 30 #include <wtf/RefPtr.h> 31 #include <wtf/text/WTFString.h> 30 #if PLATFORM(COCOA) 31 #include "ResourceLoadStatisticsClassifierCocoa.h" 32 #else 33 34 #include "ResourceLoadStatisticsClassifierBase.h" 32 35 33 36 namespace WebKit { 34 37 35 class WebResourceLoadStatisticsManager : public API::ObjectImpl<API::Object::Type::WebResourceLoadStatisticsManager>{38 class ResourceLoadStatisticsClassifier : public ResourceLoadStatisticsClassifierBase { 36 39 public: 37 static Ref<WebResourceLoadStatisticsManager> create() 40 ResourceLoadStatisticsClassifier() 41 : ResourceLoadStatisticsClassifierBase() { } 42 43 protected: 44 bool classify(const unsigned a, const unsigned b, const unsigned c) override 38 45 { 39 return adoptRef(*new WebResourceLoadStatisticsManager());46 return classifyWithVectorThreshold(a, b, c); 40 47 } 41 static void setPrevalentResource(const String& hostName, bool value);42 static bool isPrevalentResource(const String& hostName);43 static void setHasHadUserInteraction(const String& hostName, bool value);44 static bool hasHadUserInteraction(const String& hostName);45 static void setTimeToLiveUserInteraction(double seconds);46 static void setReducedTimestampResolution(double seconds);47 static void fireDataModificationHandler();48 static void setNotifyPagesWhenDataRecordsWereScanned(bool);49 static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value);50 static void setMinimumTimeBetweeenDataRecordsRemoval(double seconds);51 static void resetToConsistentState();52 53 private:54 48 }; 55 49 56 } // namespace WebKit 50 } 51 52 #endif -
trunk/Source/WebKit2/Platform/classifier/ResourceLoadStatisticsClassifierBase.h
r212756 r212757 26 26 #pragma once 27 27 28 #include "APIObject.h" 29 30 #include <wtf/RefPtr.h> 31 #include <wtf/text/WTFString.h> 28 namespace WebCore { 29 struct ResourceLoadStatistics; 30 } 32 31 33 32 namespace WebKit { 34 33 35 class WebResourceLoadStatisticsManager : public API::ObjectImpl<API::Object::Type::WebResourceLoadStatisticsManager>{34 class ResourceLoadStatisticsClassifierBase { 36 35 public: 37 static Ref<WebResourceLoadStatisticsManager> create() 38 { 39 return adoptRef(*new WebResourceLoadStatisticsManager()); 40 } 41 static void setPrevalentResource(const String& hostName, bool value); 42 static bool isPrevalentResource(const String& hostName); 43 static void setHasHadUserInteraction(const String& hostName, bool value); 44 static bool hasHadUserInteraction(const String& hostName); 45 static void setTimeToLiveUserInteraction(double seconds); 46 static void setReducedTimestampResolution(double seconds); 47 static void fireDataModificationHandler(); 48 static void setNotifyPagesWhenDataRecordsWereScanned(bool); 49 static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value); 50 static void setMinimumTimeBetweeenDataRecordsRemoval(double seconds); 51 static void resetToConsistentState(); 52 53 private: 36 bool hasPrevalentResourceCharacteristics(const WebCore::ResourceLoadStatistics& resourceStatistic); 37 protected: 38 ResourceLoadStatisticsClassifierBase() { } 39 virtual ~ResourceLoadStatisticsClassifierBase() { } 40 virtual bool classify(const unsigned, const unsigned, const unsigned) = 0; 41 bool classifyWithVectorThreshold(const unsigned, const unsigned, const unsigned); 54 42 }; 55 43 56 } // namespace WebKit44 } -
trunk/Source/WebKit2/Platform/classifier/cocoa/CorePredictionSPI.h
r212756 r212757 26 26 #pragma once 27 27 28 #include "APIObject.h" 28 #if USE(APPLE_INTERNAL_SDK) && HAVE(CORE_PREDICTION) 29 #include <CorePrediction/svm.h> 30 #else 29 31 30 #include <wtf/RefPtr.h> 31 #include <wtf/text/WTFString.h> 32 33 namespace WebKit { 34 35 class WebResourceLoadStatisticsManager : public API::ObjectImpl<API::Object::Type::WebResourceLoadStatisticsManager> { 36 public: 37 static Ref<WebResourceLoadStatisticsManager> create() 38 { 39 return adoptRef(*new WebResourceLoadStatisticsManager()); 40 } 41 static void setPrevalentResource(const String& hostName, bool value); 42 static bool isPrevalentResource(const String& hostName); 43 static void setHasHadUserInteraction(const String& hostName, bool value); 44 static bool hasHadUserInteraction(const String& hostName); 45 static void setTimeToLiveUserInteraction(double seconds); 46 static void setReducedTimestampResolution(double seconds); 47 static void fireDataModificationHandler(); 48 static void setNotifyPagesWhenDataRecordsWereScanned(bool); 49 static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value); 50 static void setMinimumTimeBetweeenDataRecordsRemoval(double seconds); 51 static void resetToConsistentState(); 52 53 private: 32 struct svm_node { 33 int index; 34 double value; 54 35 }; 55 36 56 } // namespace WebKit 37 struct svm_model { }; 38 39 #endif 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 double svm_predict_values(const struct svm_model*, const struct svm_node*, double*); 46 47 struct svm_model *svm_load_model(const char*); 48 49 #ifdef __cplusplus 50 } 51 #endif -
trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h
r212756 r212757 26 26 #pragma once 27 27 28 #include "APIObject.h" 29 30 #include <wtf/RefPtr.h> 28 #if HAVE(CORE_PREDICTION) 29 #include "CorePredictionSPI.h" 30 #endif 31 #include "ResourceLoadStatisticsClassifierBase.h" 32 #include <CoreFoundation/CoreFoundation.h> 33 #include <wtf/Platform.h> 31 34 #include <wtf/text/WTFString.h> 32 35 33 36 namespace WebKit { 34 37 35 class WebResourceLoadStatisticsManager : public API::ObjectImpl<API::Object::Type::WebResourceLoadStatisticsManager> { 38 class ResourceLoadStatisticsClassifier : public ResourceLoadStatisticsClassifierBase { 39 36 40 public: 37 static Ref<WebResourceLoadStatisticsManager> create() 38 { 39 return adoptRef(*new WebResourceLoadStatisticsManager()); 40 } 41 static void setPrevalentResource(const String& hostName, bool value); 42 static bool isPrevalentResource(const String& hostName); 43 static void setHasHadUserInteraction(const String& hostName, bool value); 44 static bool hasHadUserInteraction(const String& hostName); 45 static void setTimeToLiveUserInteraction(double seconds); 46 static void setReducedTimestampResolution(double seconds); 47 static void fireDataModificationHandler(); 48 static void setNotifyPagesWhenDataRecordsWereScanned(bool); 49 static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value); 50 static void setMinimumTimeBetweeenDataRecordsRemoval(double seconds); 51 static void resetToConsistentState(); 41 ResourceLoadStatisticsClassifier() 42 : ResourceLoadStatisticsClassifierBase() { } 52 43 53 44 private: 45 bool classify(const unsigned, const unsigned, const unsigned) override; 46 String storagePath(); 47 bool shouldUseCorePrediction(); 48 #if HAVE(CORE_PREDICTION) 49 struct svm_model* m_corePredictionModel; 50 bool m_useCorePrediction { true }; 51 #endif 54 52 }; 55 53 56 } // namespace WebKit54 } -
trunk/Source/WebKit2/PlatformGTK.cmake
r212724 r212757 46 46 Platform/IPC/unix/AttachmentUnix.cpp 47 47 Platform/IPC/unix/ConnectionUnix.cpp 48 49 Platform/classifier/ResourceLoadStatisticsClassifierBase.cpp 48 50 49 51 Platform/glib/ModuleGlib.cpp … … 866 868 "${WEBKIT2_DIR}/NetworkProcess/unix" 867 869 "${WEBKIT2_DIR}/Platform/IPC/glib" 870 "${WEBKIT2_DIR}/Platform/classifier" 868 871 "${WEBKIT2_DIR}/Shared/API/c/gtk" 869 872 "${WEBKIT2_DIR}/Shared/CoordinatedGraphics" -
trunk/Source/WebKit2/PlatformMac.cmake
r212756 r212757 49 49 50 50 Platform/cg/CGUtilities.cpp 51 52 Platform/classifier/ResourceLoadStatisticsClassifierBase.cpp 53 54 Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp 51 55 52 56 Platform/foundation/LoggingFoundation.mm … … 392 396 "${WEBKIT2_DIR}/UIProcess/ios" 393 397 "${WEBKIT2_DIR}/Platform/cg" 398 "${WEBKIT2_DIR}/Platform/classifier" 399 "${WEBKIT2_DIR}/Platform/classifier/cocoa" 394 400 "${WEBKIT2_DIR}/Platform/mac" 395 401 "${WEBKIT2_DIR}/Platform/unix" -
trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp
r212691 r212757 57 57 } 58 58 59 void WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName) 60 { 61 WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin(toWTFString(hostName), toWTFString(topFrameHostName)); 62 } 63 64 void WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName) 65 { 66 WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin(toWTFString(hostName), toWTFString(topFrameHostName)); 67 } 68 69 void WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo) 70 { 71 WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo(toWTFString(hostName), toWTFString(hostNameRedirectedTo)); 72 } 73 59 74 void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds) 60 75 { -
trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h
r212691 r212757 39 39 WK_EXPORT void WKResourceLoadStatisticsManagerSetHasHadUserInteraction(WKStringRef hostName, bool value); 40 40 WK_EXPORT bool WKResourceLoadStatisticsManagerIsHasHadUserInteraction(WKStringRef hostName); 41 WK_EXPORT void WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName); 42 WK_EXPORT void WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName); 43 WK_EXPORT void WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo); 41 44 WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds); 42 45 WK_EXPORT void WKResourceLoadStatisticsManagerSetReducedTimestampResolution(double seconds); -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp
r212691 r212757 62 62 } 63 63 64 void WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName) 65 { 66 WebCore::ResourceLoadObserver::sharedObserver().setSubframeUnderTopFrameOrigin(URL(URL(), hostName), URL(URL(), topFrameHostName)); 67 } 68 69 void WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName) 70 { 71 WebCore::ResourceLoadObserver::sharedObserver().setSubresourceUnderTopFrameOrigin(URL(URL(), hostName), URL(URL(), topFrameHostName)); 72 } 73 74 void WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo(const String& hostName, const String& hostNameRedirectedTo) 75 { 76 WebCore::ResourceLoadObserver::sharedObserver().setSubresourceUniqueRedirectTo(URL(URL(), hostName), URL(URL(), hostNameRedirectedTo)); 77 } 78 64 79 void WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction(double seconds) 65 80 { -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h
r212691 r212757 43 43 static void setHasHadUserInteraction(const String& hostName, bool value); 44 44 static bool hasHadUserInteraction(const String& hostName); 45 static void setSubframeUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName); 46 static void setSubresourceUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName); 47 static void setSubresourceUniqueRedirectTo(const String& hostName, const String& hostNameRedirectedTo); 45 48 static void setTimeToLiveUserInteraction(double seconds); 46 49 static void setReducedTimestampResolution(double seconds); -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
r212691 r212757 46 46 namespace WebKit { 47 47 48 static const auto featureVectorLengthThreshold = 3;49 48 static auto minimumTimeBetweeenDataRecordsRemoval = 60; 50 49 static OptionSet<WebKit::WebsiteDataType> dataTypesToRemove; … … 60 59 : m_resourceLoadStatisticsStore(ResourceLoadStatisticsStore::create()) 61 60 , m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue")) 62 , m_st oragePath(resourceLoadStatisticsDirectory)61 , m_statisticsStoragePath(resourceLoadStatisticsDirectory) 63 62 { 64 63 } … … 84 83 } 85 84 86 bool WebResourceLoadStatisticsStore::hasPrevalentResourceCharacteristics(const ResourceLoadStatistics& resourceStatistic)87 {88 auto subresourceUnderTopFrameOriginsCount = resourceStatistic.subresourceUnderTopFrameOrigins.size();89 auto subresourceUniqueRedirectsToCount = resourceStatistic.subresourceUniqueRedirectsTo.size();90 auto subframeUnderTopFrameOriginsCount = resourceStatistic.subframeUnderTopFrameOrigins.size();91 92 if (!subresourceUnderTopFrameOriginsCount93 && !subresourceUniqueRedirectsToCount94 && !subframeUnderTopFrameOriginsCount)95 return false;96 97 if (subresourceUnderTopFrameOriginsCount > featureVectorLengthThreshold98 || subresourceUniqueRedirectsToCount > featureVectorLengthThreshold99 || subframeUnderTopFrameOriginsCount > featureVectorLengthThreshold)100 return true;101 102 // The resource is considered prevalent if the feature vector103 // is longer than the threshold.104 // Vector length for n dimensions is sqrt(a^2 + (...) + n^2).105 double vectorLength = 0;106 vectorLength += subresourceUnderTopFrameOriginsCount * subresourceUnderTopFrameOriginsCount;107 vectorLength += subresourceUniqueRedirectsToCount * subresourceUniqueRedirectsToCount;108 vectorLength += subframeUnderTopFrameOriginsCount * subframeUnderTopFrameOriginsCount;109 110 ASSERT(vectorLength > 0);111 112 return sqrt(vectorLength) > featureVectorLengthThreshold;113 }114 115 85 void WebResourceLoadStatisticsStore::classifyResource(ResourceLoadStatistics& resourceStatistic) 116 86 { 117 if (!resourceStatistic.isPrevalentResource && hasPrevalentResourceCharacteristics(resourceStatistic)) { 87 if (!resourceStatistic.isPrevalentResource 88 && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) 118 89 resourceStatistic.isPrevalentResource = true; 119 }120 90 } 121 91 … … 249 219 String WebResourceLoadStatisticsStore::persistentStoragePath(const String& label) const 250 220 { 251 if (m_st oragePath.isEmpty())221 if (m_statisticsStoragePath.isEmpty()) 252 222 return emptyString(); 253 223 254 224 // TODO Decide what to call this file 255 return pathByAppendingComponent(m_st oragePath, label + "_resourceLog.plist");225 return pathByAppendingComponent(m_statisticsStoragePath, label + "_resourceLog.plist"); 256 226 } 257 227 … … 266 236 return; 267 237 268 if (!m_st oragePath.isEmpty())269 makeAllDirectories(m_st oragePath);238 if (!m_statisticsStoragePath.isEmpty()) 239 makeAllDirectories(m_statisticsStoragePath); 270 240 271 241 auto handle = openFile(resourceLog, OpenForWrite); -
trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h
r212691 r212757 29 29 #include "APIObject.h" 30 30 #include "Connection.h" 31 #include "ResourceLoadStatisticsClassifier.h" 31 32 #include "WebsiteDataRecord.h" 32 33 #include <WebCore/ResourceLoadStatisticsStore.h> … … 77 78 void processStatisticsAndDataRecords(); 78 79 79 bool hasPrevalentResourceCharacteristics(const WebCore::ResourceLoadStatistics&);80 80 void classifyResource(WebCore::ResourceLoadStatistics&); 81 81 void removeDataRecords(); … … 90 90 91 91 Ref<WebCore::ResourceLoadStatisticsStore> m_resourceLoadStatisticsStore; 92 ResourceLoadStatisticsClassifier m_resourceLoadStatisticsClassifier; 92 93 Ref<WTF::WorkQueue> m_statisticsQueue; 93 String m_st oragePath;94 String m_statisticsStoragePath; 94 95 bool m_resourceLoadStatisticsEnabled { false }; 95 96 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r212724 r212757 1148 1148 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; }; 1149 1149 65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1150 6B2E09BA1E57B88100C8A8B9 /* CorePredictionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B2E09B91E57B88100C8A8B9 /* CorePredictionSPI.h */; }; 1150 1151 6BE9699C1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1151 1152 6BE9699E1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */; }; 1152 1153 6BE969A01E43B86E008B7483 /* WebResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */; }; 1153 1154 6BE969A21E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969A11E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp */; }; 1155 6BE969C11E54D452008B7483 /* corePrediction_model in Resources */ = {isa = PBXBuildFile; fileRef = 6BE969C01E54D452008B7483 /* corePrediction_model */; }; 1156 6BE969C51E54D4A4008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969C41E54D4A4008B7483 /* ResourceLoadStatisticsClassifier.h */; }; 1157 6BE969C71E54D4B6008B7483 /* ResourceLoadStatisticsClassifierBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifierBase.cpp */; }; 1158 6BE969CA1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */; }; 1159 6BE969CB1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */; }; 1160 6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifierBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifierBase.h */; }; 1154 1161 6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1155 1162 728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; }; … … 3341 3348 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; }; 3342 3349 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; }; 3350 6B2E09B91E57B88100C8A8B9 /* CorePredictionSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePredictionSPI.h; sourceTree = "<group>"; }; 3343 3351 6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKResourceLoadStatisticsManager.h; sourceTree = "<group>"; }; 3344 3352 6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKResourceLoadStatisticsManager.cpp; sourceTree = "<group>"; }; 3345 3353 6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsManager.h; sourceTree = "<group>"; }; 3346 3354 6BE969A11E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsManager.cpp; sourceTree = "<group>"; }; 3355 6BE969C01E54D452008B7483 /* corePrediction_model */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = corePrediction_model; sourceTree = "<group>"; }; 3356 6BE969C41E54D4A4008B7483 /* ResourceLoadStatisticsClassifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsClassifier.h; sourceTree = "<group>"; }; 3357 6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifierBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadStatisticsClassifierBase.cpp; sourceTree = "<group>"; }; 3358 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadStatisticsClassifierCocoa.cpp; sourceTree = "<group>"; }; 3359 6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsClassifierCocoa.h; sourceTree = "<group>"; }; 3360 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifierBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsClassifierBase.h; sourceTree = "<group>"; }; 3347 3361 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb.in; path = WebProcess/com.apple.WebProcess.sb.in; sourceTree = "<group>"; }; 3348 3362 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; }; … … 4361 4375 isa = PBXGroup; 4362 4376 children = ( 4377 6BE969BF1E54D452008B7483 /* ResourceLoadStatistics */, 4363 4378 37F8C94F1AE22BD8007DAB9E /* mac */, 4364 4379 7CB16FE11724B9B5007A0A95 /* PlugInSandboxProfiles */, … … 6124 6139 sourceTree = "<group>"; 6125 6140 }; 6141 6BE969BF1E54D452008B7483 /* ResourceLoadStatistics */ = { 6142 isa = PBXGroup; 6143 children = ( 6144 6BE969C01E54D452008B7483 /* corePrediction_model */, 6145 ); 6146 name = ResourceLoadStatistics; 6147 path = Resources/ResourceLoadStatistics; 6148 sourceTree = "<group>"; 6149 }; 6150 6BE969C21E54D467008B7483 /* classifier */ = { 6151 isa = PBXGroup; 6152 children = ( 6153 6BE969C31E54D467008B7483 /* cocoa */, 6154 6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifierBase.cpp */, 6155 6BE969C41E54D4A4008B7483 /* ResourceLoadStatisticsClassifier.h */, 6156 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifierBase.h */, 6157 ); 6158 path = classifier; 6159 sourceTree = "<group>"; 6160 }; 6161 6BE969C31E54D467008B7483 /* cocoa */ = { 6162 isa = PBXGroup; 6163 children = ( 6164 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */, 6165 6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */, 6166 6B2E09B91E57B88100C8A8B9 /* CorePredictionSPI.h */, 6167 ); 6168 path = cocoa; 6169 sourceTree = "<group>"; 6170 }; 6126 6171 6EE849C41368D9040038D481 /* mac */ = { 6127 6172 isa = PBXGroup; … … 7025 7070 isa = PBXGroup; 7026 7071 children = ( 7072 6BE969C21E54D467008B7483 /* classifier */, 7027 7073 3709504118A88BA40087AE5D /* cf */, 7028 7074 1AA2E51A12E4C05600BC4966 /* cg */, … … 7908 7954 7C1BA33E1A4A0E600043E249 /* APIDictionary.h in Headers */, 7909 7955 1F7D36C118DA513F00D9D659 /* APIDownloadClient.h in Headers */, 7956 6BE969CB1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h in Headers */, 7910 7957 516A4A5D120A2CCD00C05B7F /* APIError.h in Headers */, 7911 7958 317FE7C51C487A6C00A0CA89 /* APIExperimentalFeature.h in Headers */, … … 8329 8376 BC1DD7B2114DC396005ADAF3 /* WebCoreArgumentCoders.h in Headers */, 8330 8377 512F589B12A8838800629530 /* WebCredential.h in Headers */, 8378 6BE969C51E54D4A4008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */, 8331 8379 1AA83F6D1A5B63FF00026EC6 /* WebDatabaseProvider.h in Headers */, 8332 8380 CD19A26E1A13E834008D650E /* WebDiagnosticLoggingClient.h in Headers */, … … 8414 8462 7C4694D11A51E36800AD5845 /* WebPasteboardProxy.h in Headers */, 8415 8463 7C4694CA1A4B4EA100AD5845 /* WebPasteboardProxyMessages.h in Headers */, 8464 6B2E09BA1E57B88100C8A8B9 /* CorePredictionSPI.h in Headers */, 8416 8465 1AB1F7971D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h in Headers */, 8417 8466 1AB1F78C1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h in Headers */, … … 8532 8581 1AB474D8184D43FD0051B622 /* WKBundlePageLoaderClient.h in Headers */, 8533 8582 ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */, 8583 6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifierBase.h in Headers */, 8534 8584 1AB474EA184D45130051B622 /* WKBundlePagePolicyClient.h in Headers */, 8535 8585 BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */, … … 9065 9115 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, 9066 9116 93A2A3461D246125002B59D3 /* mediaIcon.pdf in Resources */, 9117 6BE969C11E54D452008B7483 /* corePrediction_model in Resources */, 9067 9118 ); 9068 9119 runOnlyForDeploymentPostprocessing = 0; … … 9652 9703 5163199416289A6000E22F00 /* NetworkProcessMessageReceiver.cpp in Sources */, 9653 9704 E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */, 9705 6BE969CA1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp in Sources */, 9654 9706 5179556D162877B100FA43B6 /* NetworkProcessProxy.cpp in Sources */, 9655 9707 516319921628980A00E22F00 /* NetworkProcessProxyMac.mm in Sources */, … … 9996 10048 BCC43AC7127B99DE00317F16 /* WebPopupMenuMac.mm in Sources */, 9997 10049 BC5750981268F3C6006F0F12 /* WebPopupMenuProxyMac.mm in Sources */, 10050 6BE969C71E54D4B6008B7483 /* ResourceLoadStatisticsClassifierBase.cpp in Sources */, 9998 10051 BCD59800112B57BE00EC8C23 /* WebPreferences.cpp in Sources */, 9999 10052 7C85FD7F19341665000177C4 /* WebPreferencesKeys.cpp in Sources */, -
trunk/Tools/ChangeLog
r212741 r212757 1 2017-02-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Add alternate classification method 4 https://bugs.webkit.org/show_bug.cgi?id=168347 5 <rdar://problem/30352793> 6 7 Reviewed by Alex Christensen. 8 9 Added three testRunner functions to facilitate layout tests: 10 - setStatisticsSubframeUnderTopFrameOrigin() 11 - setStatisticsSubresourceUnderTopFrameOrigin() 12 - setStatisticsSubresourceUniqueRedirectTo() 13 14 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 15 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 16 (WTR::TestRunner::setStatisticsSubframeUnderTopFrameOrigin): 17 (WTR::TestRunner::setStatisticsSubresourceUnderTopFrameOrigin): 18 (WTR::TestRunner::setStatisticsSubresourceUniqueRedirectTo): 19 * WebKitTestRunner/InjectedBundle/TestRunner.h: 20 * WebKitTestRunner/TestController.cpp: 21 (WTR::TestController::setStatisticsSubframeUnderTopFrameOrigin): 22 (WTR::TestController::setStatisticsSubresourceUnderTopFrameOrigin): 23 (WTR::TestController::setStatisticsSubresourceUniqueRedirectTo): 24 * WebKitTestRunner/TestController.h: 25 * WebKitTestRunner/TestInvocation.cpp: 26 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 27 1 28 2017-02-21 Jonathan Bedard <jbedard@apple.com> 2 29 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r212691 r212757 254 254 void setStatisticsHasHadUserInteraction(DOMString hostName, boolean value); 255 255 boolean isStatisticsHasHadUserInteraction(DOMString hostName); 256 void setStatisticsSubframeUnderTopFrameOrigin(DOMString hostName, DOMString topFrameHostName); 257 void setStatisticsSubresourceUnderTopFrameOrigin(DOMString hostName, DOMString topFrameHostName); 258 void setStatisticsSubresourceUniqueRedirectTo(DOMString hostName, DOMString hostNameRedirectedTo); 256 259 void setStatisticsTimeToLiveUserInteraction(double seconds); 257 260 void statisticsFireDataModificationHandler(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r212691 r212757 1227 1227 } 1228 1228 1229 void TestRunner::setStatisticsTimeToLiveUserInteraction(double seconds) 1230 { 1231 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsTimeToLiveUserInteraction")); 1232 WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds)); 1233 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1234 } 1235 1236 void TestRunner::installStatisticsDidModifyDataRecordsCallback(JSValueRef callback) 1237 { 1238 cacheTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID, callback); 1239 } 1240 1241 void TestRunner::statisticsDidModifyDataRecordsCallback() 1242 { 1243 callTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID); 1244 } 1245 1246 void TestRunner::statisticsFireDataModificationHandler() 1247 { 1248 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsFireDataModificationHandler")); 1249 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); 1250 } 1251 1252 void TestRunner::setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool value) 1253 { 1254 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsNotifyPagesWhenDataRecordsWereScanned")); 1255 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); 1256 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1257 } 1258 1259 void TestRunner::setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool value) 1260 { 1261 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsShouldClassifyResourcesBeforeDataRecordsRemoval")); 1262 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); 1263 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1264 } 1265 1266 void TestRunner::setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds) 1267 { 1268 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsMinimumTimeBetweeenDataRecordsRemoval")); 1269 WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds)); 1270 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1271 } 1272 1273 void TestRunner::statisticsResetToConsistentState() 1274 { 1275 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsResetToConsistentState")); 1276 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); 1277 } 1278 1279 #if PLATFORM(MAC) 1280 void TestRunner::connectMockGamepad(unsigned index) 1281 { 1282 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ConnectMockGamepad")); 1283 WKRetainPtr<WKTypeRef> messageBody(AdoptWK, WKUInt64Create(index)); 1284 1285 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1286 } 1287 1288 void TestRunner::disconnectMockGamepad(unsigned index) 1289 { 1290 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("DisconnectMockGamepad")); 1291 WKRetainPtr<WKTypeRef> messageBody(AdoptWK, WKUInt64Create(index)); 1292 1293 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1294 } 1295 1296 void TestRunner::setMockGamepadDetails(unsigned index, JSStringRef gamepadID, unsigned axisCount, unsigned buttonCount) 1229 void TestRunner::setStatisticsSubframeUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName) 1297 1230 { 1298 1231 Vector<WKRetainPtr<WKStringRef>> keys; 1299 1232 Vector<WKRetainPtr<WKTypeRef>> values; 1300 1301 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadID") }); 1302 values.append(toWK(gamepadID)); 1303 1304 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadIndex") }); 1305 values.append({ AdoptWK, WKUInt64Create(index) }); 1306 1307 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("AxisCount") }); 1308 values.append({ AdoptWK, WKUInt64Create(axisCount) }); 1309 1310 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ButtonCount") }); 1311 values.append({ AdoptWK, WKUInt64Create(buttonCount) }); 1312 1233 1234 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") }); 1235 values.append({ AdoptWK, WKStringCreateWithJSString(hostName) }); 1236 1237 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("TopFrameHostName") }); 1238 values.append({ AdoptWK, WKStringCreateWithJSString(topFrameHostName) }); 1239 1313 1240 Vector<WKStringRef> rawKeys; 1314 1241 Vector<WKTypeRef> rawValues; 1315 1242 rawKeys.resize(keys.size()); 1316 1243 rawValues.resize(values.size()); 1317 1244 1318 1245 for (size_t i = 0; i < keys.size(); ++i) { 1319 1246 rawKeys[i] = keys[i].get(); 1320 1247 rawValues[i] = values[i].get(); 1321 1248 } 1322 1323 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("Set MockGamepadDetails"));1249 1250 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsSubframeUnderTopFrameOrigin")); 1324 1251 WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); 1325 1326 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1327 } 1328 1329 void TestRunner::setMockGamepadAxisValue(unsigned index, unsigned axisIndex, double value) 1252 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1253 } 1254 1255 void TestRunner::setStatisticsSubresourceUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName) 1330 1256 { 1331 1257 Vector<WKRetainPtr<WKStringRef>> keys; 1332 1258 Vector<WKRetainPtr<WKTypeRef>> values; 1333 1334 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadIndex") }); 1335 values.append({ AdoptWK, WKUInt64Create(index) }); 1336 1337 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("AxisIndex") }); 1338 values.append({ AdoptWK, WKUInt64Create(axisIndex) }); 1339 1340 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("Value") }); 1341 values.append({ AdoptWK, WKDoubleCreate(value) }); 1342 1259 1260 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") }); 1261 values.append({ AdoptWK, WKStringCreateWithJSString(hostName) }); 1262 1263 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("TopFrameHostName") }); 1264 values.append({ AdoptWK, WKStringCreateWithJSString(topFrameHostName) }); 1265 1343 1266 Vector<WKStringRef> rawKeys; 1344 1267 Vector<WKTypeRef> rawValues; 1345 1268 rawKeys.resize(keys.size()); 1346 1269 rawValues.resize(values.size()); 1347 1270 1348 1271 for (size_t i = 0; i < keys.size(); ++i) { 1349 1272 rawKeys[i] = keys[i].get(); 1350 1273 rawValues[i] = values[i].get(); 1351 1274 } 1352 1353 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("Set MockGamepadAxisValue"));1275 1276 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsSubresourceUnderTopFrameOrigin")); 1354 1277 WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); 1355 1356 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1357 } 1358 1359 void TestRunner::setMockGamepadButtonValue(unsigned index, unsigned buttonIndex, double value) 1278 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1279 } 1280 1281 void TestRunner::setStatisticsSubresourceUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo) 1360 1282 { 1361 1283 Vector<WKRetainPtr<WKStringRef>> keys; 1362 1284 Vector<WKRetainPtr<WKTypeRef>> values; 1363 1364 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadIndex") }); 1365 values.append({ AdoptWK, WKUInt64Create(index) }); 1366 1367 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ButtonIndex") }); 1368 values.append({ AdoptWK, WKUInt64Create(buttonIndex) }); 1369 1370 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("Value") }); 1371 values.append({ AdoptWK, WKDoubleCreate(value) }); 1372 1285 1286 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") }); 1287 values.append({ AdoptWK, WKStringCreateWithJSString(hostName) }); 1288 1289 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostNameRedirectedTo") }); 1290 values.append({ AdoptWK, WKStringCreateWithJSString(hostNameRedirectedTo) }); 1291 1373 1292 Vector<WKStringRef> rawKeys; 1374 1293 Vector<WKTypeRef> rawValues; 1375 1294 rawKeys.resize(keys.size()); 1376 1295 rawValues.resize(values.size()); 1377 1296 1378 1297 for (size_t i = 0; i < keys.size(); ++i) { 1379 1298 rawKeys[i] = keys[i].get(); 1380 1299 rawValues[i] = values[i].get(); 1381 1300 } 1301 1302 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsSubresourceUniqueRedirectTo")); 1303 WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); 1304 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1305 } 1306 1307 void TestRunner::setStatisticsTimeToLiveUserInteraction(double seconds) 1308 { 1309 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsTimeToLiveUserInteraction")); 1310 WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds)); 1311 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1312 } 1313 1314 void TestRunner::installStatisticsDidModifyDataRecordsCallback(JSValueRef callback) 1315 { 1316 cacheTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID, callback); 1317 } 1318 1319 void TestRunner::statisticsDidModifyDataRecordsCallback() 1320 { 1321 callTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID); 1322 } 1323 1324 void TestRunner::statisticsFireDataModificationHandler() 1325 { 1326 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsFireDataModificationHandler")); 1327 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); 1328 } 1329 1330 void TestRunner::setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool value) 1331 { 1332 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsNotifyPagesWhenDataRecordsWereScanned")); 1333 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); 1334 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1335 } 1336 1337 void TestRunner::setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool value) 1338 { 1339 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsShouldClassifyResourcesBeforeDataRecordsRemoval")); 1340 WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value)); 1341 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1342 } 1343 1344 void TestRunner::setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds) 1345 { 1346 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsMinimumTimeBetweeenDataRecordsRemoval")); 1347 WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds)); 1348 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1349 } 1350 1351 void TestRunner::statisticsResetToConsistentState() 1352 { 1353 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsResetToConsistentState")); 1354 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); 1355 } 1356 1357 #if PLATFORM(MAC) 1358 void TestRunner::connectMockGamepad(unsigned index) 1359 { 1360 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ConnectMockGamepad")); 1361 WKRetainPtr<WKTypeRef> messageBody(AdoptWK, WKUInt64Create(index)); 1362 1363 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1364 } 1365 1366 void TestRunner::disconnectMockGamepad(unsigned index) 1367 { 1368 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("DisconnectMockGamepad")); 1369 WKRetainPtr<WKTypeRef> messageBody(AdoptWK, WKUInt64Create(index)); 1370 1371 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1372 } 1373 1374 void TestRunner::setMockGamepadDetails(unsigned index, JSStringRef gamepadID, unsigned axisCount, unsigned buttonCount) 1375 { 1376 Vector<WKRetainPtr<WKStringRef>> keys; 1377 Vector<WKRetainPtr<WKTypeRef>> values; 1378 1379 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadID") }); 1380 values.append(toWK(gamepadID)); 1381 1382 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadIndex") }); 1383 values.append({ AdoptWK, WKUInt64Create(index) }); 1384 1385 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("AxisCount") }); 1386 values.append({ AdoptWK, WKUInt64Create(axisCount) }); 1387 1388 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ButtonCount") }); 1389 values.append({ AdoptWK, WKUInt64Create(buttonCount) }); 1390 1391 Vector<WKStringRef> rawKeys; 1392 Vector<WKTypeRef> rawValues; 1393 rawKeys.resize(keys.size()); 1394 rawValues.resize(values.size()); 1395 1396 for (size_t i = 0; i < keys.size(); ++i) { 1397 rawKeys[i] = keys[i].get(); 1398 rawValues[i] = values[i].get(); 1399 } 1400 1401 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGamepadDetails")); 1402 WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); 1403 1404 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1405 } 1406 1407 void TestRunner::setMockGamepadAxisValue(unsigned index, unsigned axisIndex, double value) 1408 { 1409 Vector<WKRetainPtr<WKStringRef>> keys; 1410 Vector<WKRetainPtr<WKTypeRef>> values; 1411 1412 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadIndex") }); 1413 values.append({ AdoptWK, WKUInt64Create(index) }); 1414 1415 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("AxisIndex") }); 1416 values.append({ AdoptWK, WKUInt64Create(axisIndex) }); 1417 1418 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("Value") }); 1419 values.append({ AdoptWK, WKDoubleCreate(value) }); 1420 1421 Vector<WKStringRef> rawKeys; 1422 Vector<WKTypeRef> rawValues; 1423 rawKeys.resize(keys.size()); 1424 rawValues.resize(values.size()); 1425 1426 for (size_t i = 0; i < keys.size(); ++i) { 1427 rawKeys[i] = keys[i].get(); 1428 rawValues[i] = values[i].get(); 1429 } 1430 1431 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGamepadAxisValue")); 1432 WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); 1433 1434 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1435 } 1436 1437 void TestRunner::setMockGamepadButtonValue(unsigned index, unsigned buttonIndex, double value) 1438 { 1439 Vector<WKRetainPtr<WKStringRef>> keys; 1440 Vector<WKRetainPtr<WKTypeRef>> values; 1441 1442 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("GamepadIndex") }); 1443 values.append({ AdoptWK, WKUInt64Create(index) }); 1444 1445 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("ButtonIndex") }); 1446 values.append({ AdoptWK, WKUInt64Create(buttonIndex) }); 1447 1448 keys.append({ AdoptWK, WKStringCreateWithUTF8CString("Value") }); 1449 values.append({ AdoptWK, WKDoubleCreate(value) }); 1450 1451 Vector<WKStringRef> rawKeys; 1452 Vector<WKTypeRef> rawValues; 1453 rawKeys.resize(keys.size()); 1454 rawValues.resize(values.size()); 1455 1456 for (size_t i = 0; i < keys.size(); ++i) { 1457 rawKeys[i] = keys[i].get(); 1458 rawValues[i] = values[i].get(); 1459 } 1382 1460 1383 1461 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGamepadButtonValue")); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r212691 r212757 355 355 void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value); 356 356 bool isStatisticsHasHadUserInteraction(JSStringRef hostName); 357 void setStatisticsSubframeUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName); 358 void setStatisticsSubresourceUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName); 359 void setStatisticsSubresourceUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo); 357 360 void setStatisticsTimeToLiveUserInteraction(double seconds); 358 361 void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r212691 r212757 2230 2230 } 2231 2231 2232 void TestController::setStatisticsSubframeUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName) 2233 { 2234 WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin(hostName, topFrameHostName); 2235 } 2236 2237 void TestController::setStatisticsSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName) 2238 { 2239 WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin(hostName, topFrameHostName); 2240 } 2241 2242 void TestController::setStatisticsSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo) 2243 { 2244 WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(hostName, hostNameRedirectedTo); 2245 } 2246 2232 2247 void TestController::setStatisticsTimeToLiveUserInteraction(double seconds) 2233 2248 { -
trunk/Tools/WebKitTestRunner/TestController.h
r212691 r212757 153 153 void setStatisticsHasHadUserInteraction(WKStringRef hostName, bool value); 154 154 bool isStatisticsHasHadUserInteraction(WKStringRef hostName); 155 void setStatisticsSubframeUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName); 156 void setStatisticsSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName); 157 void setStatisticsSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo); 155 158 void setStatisticsTimeToLiveUserInteraction(double seconds); 156 159 void statisticsFireDataModificationHandler(); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r212691 r212757 933 933 } 934 934 935 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsSubframeUnderTopFrameOrigin")) { 936 ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID()); 937 938 WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody); 939 WKRetainPtr<WKStringRef> hostNameKey(AdoptWK, WKStringCreateWithUTF8CString("HostName")); 940 WKRetainPtr<WKStringRef> topFrameHostNameKey(AdoptWK, WKStringCreateWithUTF8CString("TopFrameHostName")); 941 942 WKStringRef hostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get())); 943 WKStringRef topFrameHostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, topFrameHostNameKey.get())); 944 945 TestController::singleton().setStatisticsSubframeUnderTopFrameOrigin(hostName, topFrameHostName); 946 return nullptr; 947 } 948 949 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsSubresourceUnderTopFrameOrigin")) { 950 ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID()); 951 952 WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody); 953 WKRetainPtr<WKStringRef> hostNameKey(AdoptWK, WKStringCreateWithUTF8CString("HostName")); 954 WKRetainPtr<WKStringRef> topFrameHostNameKey(AdoptWK, WKStringCreateWithUTF8CString("TopFrameHostName")); 955 956 WKStringRef hostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get())); 957 WKStringRef topFrameHostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, topFrameHostNameKey.get())); 958 959 TestController::singleton().setStatisticsSubresourceUnderTopFrameOrigin(hostName, topFrameHostName); 960 return nullptr; 961 } 962 963 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsSubresourceUniqueRedirectTo")) { 964 ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID()); 965 966 WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody); 967 WKRetainPtr<WKStringRef> hostNameKey(AdoptWK, WKStringCreateWithUTF8CString("HostName")); 968 WKRetainPtr<WKStringRef> hostNameRedirectedToKey(AdoptWK, WKStringCreateWithUTF8CString("HostNameRedirectedTo")); 969 970 WKStringRef hostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get())); 971 WKStringRef hostNameRedirectedTo = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameRedirectedToKey.get())); 972 973 TestController::singleton().setStatisticsSubresourceUniqueRedirectTo(hostName, hostNameRedirectedTo); 974 return nullptr; 975 } 976 935 977 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsTimeToLiveUserInteraction")) { 936 978 ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID()); -
trunk/WebKitLibraries/ChangeLog
r212691 r212757 1 2017-02-21 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Add alternate classification method 4 https://bugs.webkit.org/show_bug.cgi?id=168347 5 <rdar://problem/30352793> 6 7 Reviewed by Alex Christensen. 8 9 * WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework: Added. 10 * WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd: Added. 11 Stubs for private framework. 12 1 13 2017-02-20 Ryan Haddad <ryanhaddad@apple.com> 2 14
Note: See TracChangeset
for help on using the changeset viewer.