Changeset 212949 in webkit


Ignore:
Timestamp:
Feb 24, 2017 1:19:53 AM (7 years ago)
Author:
wilander@apple.com
Message:

Resource Load Statistics: Add alternate classification method
https://bugs.webkit.org/show_bug.cgi?id=168347
<rdar://problem/30352793>
<rdar://problem/30646710>
<rdar://problem/30660708>

Reviewed by Alex Christensen.

Source/WebCore:

This patch only adds test infrastructure in WebCore.

Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html

http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html

  • loader/ResourceLoadObserver.cpp:

(WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
(WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
(WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):

  • loader/ResourceLoadObserver.h:

Source/WebKit2:

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.

  • Platform/Logging.h:

Added channel ResourceLoadStatistics.

  • 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/CorePredictionSoftLink.h: Added.

Soft links to CorePrediction and the two functions we use from it.

  • Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Added.

(WebKit::ResourceLoadStatisticsClassifier::classify):
(WebKit::ResourceLoadStatisticsClassifier::storagePath):
(WebKit::ResourceLoadStatisticsClassifier::shouldUseCorePredictionAndHaveModelLoaded):
(WebKit::ResourceLoadStatisticsClassifier::singletonPredictionModel):

The new classifier for Cocoa platforms.

  • Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Added.
  • 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/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.

Tools:

Added three testRunner functions to facilitate layout tests:

  • setStatisticsSubframeUnderTopFrameOrigin()
  • setStatisticsSubresourceUnderTopFrameOrigin()
  • setStatisticsSubresourceUniqueRedirectTo()
  • WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::setStatisticsSubframeUnderTopFrameOrigin):
(WTR::TestRunner::setStatisticsSubresourceUnderTopFrameOrigin):
(WTR::TestRunner::setStatisticsSubresourceUniqueRedirectTo):

  • WebKitTestRunner/InjectedBundle/TestRunner.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::setStatisticsSubframeUnderTopFrameOrigin):
(WTR::TestController::setStatisticsSubresourceUnderTopFrameOrigin):
(WTR::TestController::setStatisticsSubresourceUniqueRedirectTo):

  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to-expected.txt: Added.
  • http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html: Added.
  • http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html:

Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().

  • http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html:

Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().

  • http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:

Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().

  • http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:

Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().

  • http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:

Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().

  • platform/gtk/TestExpectations:

The whole http/tests/loading/resourceLoadStatistics marked as crashing based on
Carlos Garcia Campos's assessment in https://bugs.webkit.org/show_bug.cgi?id=168171.

  • platform/wk2/TestExpectations:

The above tests are only valid for WebKit2. Marked as [ Pass ].

Location:
trunk
Files:
19 added
29 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r212948 r212949  
     12017-02-24  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        <rdar://problem/30646710>
     7        <rdar://problem/30660708>
     8
     9        Reviewed by Alex Christensen.
     10
     11        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-expected.txt: Added.
     12        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html: Added.
     13        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins-expected.txt: Added.
     14        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html: Added.
     15        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins-expected.txt: Added.
     16        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html: Added.
     17        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to-expected.txt: Added.
     18        * http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html: Added.
     19        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics-expected.txt: Added.
     20        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html: Added.
     21        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins-expected.txt: Added.
     22        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html: Added.
     23        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins-expected.txt: Added.
     24        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html: Added.
     25        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to-expected.txt: Added.
     26        * http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html: Added.
     27        * http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html:
     28            Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().
     29        * http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html:
     30            Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().
     31        * http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:
     32            Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().
     33        * http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
     34            Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().
     35        * http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:
     36            Added a call to internals.setResourceLoadStatisticsEnabled(false) before testRunner.notifyDone().
     37        * platform/gtk/TestExpectations:
     38            The whole http/tests/loading/resourceLoadStatistics marked as crashing based on
     39            Carlos Garcia Campos's assessment in https://bugs.webkit.org/show_bug.cgi?id=168171.
     40        * platform/wk2/TestExpectations:
     41            The above tests are only valid for WebKit2. Marked as [ Pass ].
     42
    1432017-02-23  Antoine Quint  <graouts@apple.com>
    244
  • trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html

    r212183 r212949  
    3939                testFailed("Cookie deleted or document.cookie contains other cookies: " + document.cookie);
    4040            testRunner.statisticsResetToConsistentState();
     41            internals.setResourceLoadStatisticsEnabled(false);
    4142            testRunner.notifyDone();
    4243        });
  • trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html

    r212183 r212949  
    3939                testFailed("Cookie deleted or document.cookie contains other cookies: " + document.cookie);
    4040            testRunner.statisticsResetToConsistentState();
     41            internals.setResourceLoadStatisticsEnabled(false);
    4142            testRunner.notifyDone();
    4243        });
  • trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html

    r212183 r212949  
    3232                testPassed("Cookie deleted.");
    3333            testRunner.statisticsResetToConsistentState();
     34            internals.setResourceLoadStatisticsEnabled(false);
    3435            testRunner.notifyDone();
    3536        });
  • trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html

    r212183 r212949  
    3939                testFailed("Cookie deleted or document.cookie contains other cookies: " + document.cookie);
    4040            testRunner.statisticsResetToConsistentState();
     41            internals.setResourceLoadStatisticsEnabled(false);
    4142            testRunner.notifyDone();
    4243        });
  • trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html

    r212183 r212949  
    3232                testPassed("Cookie deleted.");
    3333            testRunner.statisticsResetToConsistentState();
     34            internals.setResourceLoadStatisticsEnabled(false);
    3435            testRunner.notifyDone();
    3536        });
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r212944 r212949  
    950950webkit.org/b/163782 media/video-played-ranges-1.html [ Crash Pass ]
    951951
    952 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html [ Crash ]
    953 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html [ Crash ]
    954 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html [ Crash ]
    955 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html [ Crash ]
    956 webkit.org/b/168171 http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html [ Crash ]
     952webkit.org/b/168171 http/tests/loading/resourceLoadStatistics [ Crash ]
    957953
    958954webkit.org/b/167576 imported/w3c/IndexedDB-private-browsing/idbcursor_iterating.html [ Crash ]
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r212841 r212949  
    706706http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html [ Pass Timeout ]
    707707http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html [ Pass Timeout ]
     708http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html [ Pass ]
     709http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html [ Pass ]
     710http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html [ Pass ]
     711http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html [ Pass ]
     712http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html [ Pass ]
     713http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html [ Pass ]
     714http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html [ Pass ]
     715http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html [ Pass ]
    708716
    709717### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
  • trunk/Source/WebCore/ChangeLog

    r212948 r212949  
     12017-02-24  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        <rdar://problem/30646710>
     7        <rdar://problem/30660708>
     8
     9        Reviewed by Alex Christensen.
     10
     11        This patch only adds test infrastructure in WebCore.
     12
     13        Tests: http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html
     14               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html
     15               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html
     16               http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html
     17               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html
     18               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html
     19               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html
     20               http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html
     21
     22        * loader/ResourceLoadObserver.cpp:
     23        (WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
     24        (WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
     25        (WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
     26        * loader/ResourceLoadObserver.h:
     27
    1282017-02-23  Antoine Quint  <graouts@apple.com>
    229
  • trunk/Source/WebCore/loader/ResourceLoadObserver.cpp

    r212841 r212949  
    376376}
    377377
     378void 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
     387void 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
     396void 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
    378405void ResourceLoadObserver::setTimeToLiveUserInteraction(double seconds)
    379406{
  • trunk/Source/WebCore/loader/ResourceLoadObserver.h

    r212841 r212949  
    5959    WEBCORE_EXPORT void clearPrevalentResource(const URL&);
    6060
     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
    6165    WEBCORE_EXPORT void setTimeToLiveUserInteraction(double seconds);
    6266    WEBCORE_EXPORT void setReducedTimestampResolution(double seconds);
  • trunk/Source/WebKit2/ChangeLog

    r212945 r212949  
     12017-02-24  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        <rdar://problem/30646710>
     7        <rdar://problem/30660708>
     8
     9        Reviewed by Alex Christensen.
     10
     11        This patch adds a CorePrediction-based classifier to the WebResourceLoadStatisticsStore.
     12        The CorePrediction framework is introduced as a dependency for macOS and iOS. The patch
     13        also adds functions to support layout tests of the feature.
     14
     15        * Platform/Logging.h:
     16            Added channel ResourceLoadStatistics.
     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/CorePredictionSoftLink.h: Added.
     29            Soft links to CorePrediction and the two functions we use from it.
     30        * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Added.
     31        (WebKit::ResourceLoadStatisticsClassifier::classify):
     32        (WebKit::ResourceLoadStatisticsClassifier::storagePath):
     33        (WebKit::ResourceLoadStatisticsClassifier::shouldUseCorePredictionAndHaveModelLoaded):
     34        (WebKit::ResourceLoadStatisticsClassifier::singletonPredictionModel):
     35            The new classifier for Cocoa platforms.
     36        * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Added.
     37        * PlatformGTK.cmake:
     38            Added Platform/classifier directory and ResourceLoadStatisticsClassifierBase.cpp.
     39        * PlatformMac.cmake:
     40            Added Platform/classifier and Platform/classifier/cocoa directories, and
     41            source files ResourceLoadStatisticsClassifierBase.cpp and
     42            ResourceLoadStatisticsClassifierCocoa.cpp
     43        * Resources/ResourceLoadStatistics/corePrediction_model: Added.
     44            Model file to load into CorePrediction.
     45        * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
     46        (WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin):
     47        (WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin):
     48        (WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo):
     49            Test infrastructure.
     50        * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
     51        * UIProcess/WebResourceLoadStatisticsManager.cpp:
     52        (WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
     53        (WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
     54        (WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
     55            Test infrastructure.
     56        * UIProcess/WebResourceLoadStatisticsManager.h:
     57        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     58        (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
     59            Renamed m_storagePath to m_statisticsStoragePath for clarity.
     60        (WebKit::WebResourceLoadStatisticsStore::classifyResource):
     61            Now calls the classifier through its ResourceLoadStatisticsClassifier
     62            member variable.
     63        (WebKit::WebResourceLoadStatisticsStore::persistentStoragePath):
     64            Renamed m_storagePath to m_statisticsStoragePath for clarity.
     65        (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
     66            Renamed m_storagePath to m_statisticsStoragePath for clarity.
     67        (WebKit::WebResourceLoadStatisticsStore::hasPrevalentResourceCharacteristics): Deleted.
     68        * UIProcess/WebResourceLoadStatisticsStore.h:
     69        * WebKit2.xcodeproj/project.pbxproj:
     70            Added the new classifier source files under Platform/classifier and the
     71            corePrediction_model file under Resources/ResourceLoadStatistics.
     72
    1732017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
    274
  • trunk/Source/WebKit2/Platform/Logging.h

    r212312 r212949  
    6464    M(RemoteLayerTree) \
    6565    M(Resize) \
     66    M(ResourceLoadStatistics) \
    6667    M(Selection) \
    6768    M(SessionState) \
  • trunk/Source/WebKit2/Platform/classifier/ResourceLoadStatisticsClassifier.h

    r212948 r212949  
    2626#pragma once
    2727
    28 #include "APIObject.h"
    29 
    30 #include <wtf/RefPtr.h>
    31 #include <wtf/text/WTFString.h>
     28namespace WebCore {
     29struct ResourceLoadStatistics;
     30}
    3231
    3332namespace WebKit {
    3433
    35 class WebResourceLoadStatisticsManager : public API::ObjectImpl<API::Object::Type::WebResourceLoadStatisticsManager> {
     34class ResourceLoadStatisticsClassifier {
    3635public:
    37     static Ref<WebResourceLoadStatisticsManager> create()
     36    ResourceLoadStatisticsClassifier() = default;
     37    virtual ~ResourceLoadStatisticsClassifier() = default;
     38    bool hasPrevalentResourceCharacteristics(const WebCore::ResourceLoadStatistics& resourceStatistic);
     39protected:
     40    virtual bool classify(unsigned subresourceUnderTopFrameOriginsCount, unsigned subresourceUniqueRedirectsToCount, unsigned subframeUnderTopFrameOriginsCount)
    3841    {
    39         return adoptRef(*new WebResourceLoadStatisticsManager());
     42        return classifyWithVectorThreshold(subresourceUnderTopFrameOriginsCount, subresourceUniqueRedirectsToCount, subframeUnderTopFrameOriginsCount);
    4043    }
    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:
     44    bool classifyWithVectorThreshold(unsigned, unsigned, unsigned);
    5445};
    5546
    56 } // namespace WebKit
     47}
  • trunk/Source/WebKit2/Platform/classifier/cocoa/CorePredictionSoftLink.h

    r212948 r212949  
    2626#pragma once
    2727
    28 #include "APIObject.h"
     28#include <WebCore/SoftLinking.h>
    2929
    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:
     30struct svm_model;
     31struct svm_node {
     32    int index;
     33    double value;
    5434};
    5535
    56 } // namespace WebKit
     36SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(CorePrediction)
     37SOFT_LINK(CorePrediction, svm_predict_values, double, (const struct svm_model *model, const struct svm_node *x, double* dec_values), (model, x, dec_values))
     38SOFT_LINK(CorePrediction, svm_load_model, svm_model*, (const char *model_file_name), (model_file_name))
  • trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h

    r212948 r212949  
    2626#pragma once
    2727
    28 #include "APIObject.h"
     28#include "ResourceLoadStatisticsClassifier.h"
     29#include <wtf/Platform.h>
     30#include <wtf/text/WTFString.h>
    2931
    30 #include <wtf/RefPtr.h>
    31 #include <wtf/text/WTFString.h>
     32struct svm_model;
    3233
    3334namespace WebKit {
    3435
    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 
     36class ResourceLoadStatisticsClassifierCocoa : public ResourceLoadStatisticsClassifier {
    5337private:
     38    bool classify(unsigned, unsigned, unsigned) override;
     39    String storagePath();
     40    bool canUseCorePrediction();
     41    const struct svm_model* singletonPredictionModel();
     42    bool m_useCorePrediction { true };
     43    bool m_haveLoadedModel { false };
    5444};
    55 
    56 } // namespace WebKit
     45   
     46}
  • trunk/Source/WebKit2/PlatformGTK.cmake

    r212841 r212949  
    4646    Platform/IPC/unix/AttachmentUnix.cpp
    4747    Platform/IPC/unix/ConnectionUnix.cpp
     48
     49    Platform/classifier/ResourceLoadStatisticsClassifier.cpp
    4850
    4951    Platform/glib/ModuleGlib.cpp
     
    866868    "${WEBKIT2_DIR}/NetworkProcess/unix"
    867869    "${WEBKIT2_DIR}/Platform/IPC/glib"
     870    "${WEBKIT2_DIR}/Platform/classifier"
    868871    "${WEBKIT2_DIR}/Shared/API/c/gtk"
    869872    "${WEBKIT2_DIR}/Shared/CoordinatedGraphics"
  • trunk/Source/WebKit2/PlatformMac.cmake

    r212841 r212949  
    4949
    5050    Platform/cg/CGUtilities.cpp
     51
     52    Platform/classifier/ResourceLoadStatisticsClassifier.cpp
     53
     54    Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp
    5155
    5256    Platform/foundation/LoggingFoundation.mm
     
    392396    "${WEBKIT2_DIR}/UIProcess/ios"
    393397    "${WEBKIT2_DIR}/Platform/cg"
     398    "${WEBKIT2_DIR}/Platform/classifier"
     399    "${WEBKIT2_DIR}/Platform/classifier/cocoa"
    394400    "${WEBKIT2_DIR}/Platform/mac"
    395401    "${WEBKIT2_DIR}/Platform/unix"
  • trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp

    r212841 r212949  
    5757}
    5858
     59void WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName)
     60{
     61    WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin(toWTFString(hostName), toWTFString(topFrameHostName));
     62}
     63
     64void WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName)
     65{
     66    WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin(toWTFString(hostName), toWTFString(topFrameHostName));
     67}
     68
     69void WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo)
     70{
     71    WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo(toWTFString(hostName), toWTFString(hostNameRedirectedTo));
     72}
     73
    5974void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds)
    6075{
  • trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h

    r212841 r212949  
    3939    WK_EXPORT void WKResourceLoadStatisticsManagerSetHasHadUserInteraction(WKStringRef hostName, bool value);
    4040    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);
    4144    WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds);
    4245    WK_EXPORT void WKResourceLoadStatisticsManagerSetReducedTimestampResolution(double seconds);
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp

    r212841 r212949  
    6262}
    6363
     64void WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName)
     65{
     66    WebCore::ResourceLoadObserver::sharedObserver().setSubframeUnderTopFrameOrigin(URL(URL(), hostName), URL(URL(), topFrameHostName));
     67}
     68
     69void WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin(const String& hostName, const String& topFrameHostName)
     70{
     71    WebCore::ResourceLoadObserver::sharedObserver().setSubresourceUnderTopFrameOrigin(URL(URL(), hostName), URL(URL(), topFrameHostName));
     72}
     73
     74void WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo(const String& hostName, const String& hostNameRedirectedTo)
     75{
     76    WebCore::ResourceLoadObserver::sharedObserver().setSubresourceUniqueRedirectTo(URL(URL(), hostName), URL(URL(), hostNameRedirectedTo));
     77}
     78
    6479void WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction(double seconds)
    6580{
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h

    r212841 r212949  
    4343    static void setHasHadUserInteraction(const String& hostName, bool value);
    4444    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);
    4548    static void setTimeToLiveUserInteraction(double seconds);
    4649    static void setReducedTimestampResolution(double seconds);
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp

    r212841 r212949  
    4646namespace WebKit {
    4747
    48 static const auto featureVectorLengthThreshold = 3;
    4948static auto minimumTimeBetweeenDataRecordsRemoval = 60;
    5049static OptionSet<WebKit::WebsiteDataType> dataTypesToRemove;
     
    6059    : m_resourceLoadStatisticsStore(ResourceLoadStatisticsStore::create())
    6160    , m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue"))
    62     , m_storagePath(resourceLoadStatisticsDirectory)
     61    , m_statisticsStoragePath(resourceLoadStatisticsDirectory)
    6362{
    6463}
     
    8483}
    8584
    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 (!subresourceUnderTopFrameOriginsCount
    93         && !subresourceUniqueRedirectsToCount
    94         && !subframeUnderTopFrameOriginsCount)
    95         return false;
    96 
    97     if (subresourceUnderTopFrameOriginsCount > featureVectorLengthThreshold
    98         || subresourceUniqueRedirectsToCount > featureVectorLengthThreshold
    99         || subframeUnderTopFrameOriginsCount > featureVectorLengthThreshold)
    100         return true;
    101 
    102     // The resource is considered prevalent if the feature vector
    103     // 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    
    11585void WebResourceLoadStatisticsStore::classifyResource(ResourceLoadStatistics& resourceStatistic)
    11686{
    117     if (!resourceStatistic.isPrevalentResource && hasPrevalentResourceCharacteristics(resourceStatistic)) {
     87    if (!resourceStatistic.isPrevalentResource
     88        && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
    11889        resourceStatistic.isPrevalentResource = true;
    119     }
    12090}
    12191
     
    250220String WebResourceLoadStatisticsStore::persistentStoragePath(const String& label) const
    251221{
    252     if (m_storagePath.isEmpty())
     222    if (m_statisticsStoragePath.isEmpty())
    253223        return emptyString();
    254224
    255225    // TODO Decide what to call this file
    256     return pathByAppendingComponent(m_storagePath, label + "_resourceLog.plist");
     226    return pathByAppendingComponent(m_statisticsStoragePath, label + "_resourceLog.plist");
    257227}
    258228
     
    267237        return;
    268238
    269     if (!m_storagePath.isEmpty())
    270         makeAllDirectories(m_storagePath);
     239    if (!m_statisticsStoragePath.isEmpty())
     240        makeAllDirectories(m_statisticsStoragePath);
    271241
    272242    auto handle = openFile(resourceLog, OpenForWrite);
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h

    r212841 r212949  
    2424 */
    2525
    26 #ifndef WebResourceLoadStatisticsStore_h
    27 #define WebResourceLoadStatisticsStore_h
     26#pragma once
    2827
    2928#include "APIObject.h"
    3029#include "Connection.h"
     30#include "ResourceLoadStatisticsClassifier.h"
    3131#include "WebsiteDataRecord.h"
    3232#include <WebCore/ResourceLoadStatisticsStore.h>
    3333#include <wtf/Vector.h>
    3434#include <wtf/text/WTFString.h>
     35
     36#if PLATFORM(COCOA)
     37#include "ResourceLoadStatisticsClassifierCocoa.h"
     38#endif
    3539
    3640namespace WTF {
     
    7781    void processStatisticsAndDataRecords();
    7882
    79     bool hasPrevalentResourceCharacteristics(const WebCore::ResourceLoadStatistics&);
    8083    void classifyResource(WebCore::ResourceLoadStatistics&);
    8184    void removeDataRecords();
     
    9093
    9194    Ref<WebCore::ResourceLoadStatisticsStore> m_resourceLoadStatisticsStore;
     95#if PLATFORM(COCOA)
     96    ResourceLoadStatisticsClassifierCocoa m_resourceLoadStatisticsClassifier;
     97#else
     98    ResourceLoadStatisticsClassifier m_resourceLoadStatisticsClassifier;
     99#endif
    92100    Ref<WTF::WorkQueue> m_statisticsQueue;
    93     String m_storagePath;
     101    String m_statisticsStoragePath;
    94102    bool m_resourceLoadStatisticsEnabled { false };
    95103
     
    99107
    100108} // namespace WebKit
    101 
    102 #endif // WebResourceLoadStatisticsStore_h
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r212929 r212949  
    11481148                659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; };
    11491149                65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1150                6B2E09BA1E57B88100C8A8B9 /* CorePredictionSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B2E09B91E57B88100C8A8B9 /* CorePredictionSoftLink.h */; };
    11501151                6BE9699C1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11511152                6BE9699E1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */; };
    11521153                6BE969A01E43B86E008B7483 /* WebResourceLoadStatisticsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */; };
    11531154                6BE969A21E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969A11E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp */; };
     1155                6BE969C11E54D452008B7483 /* corePrediction_model in Resources */ = {isa = PBXBuildFile; fileRef = 6BE969C01E54D452008B7483 /* corePrediction_model */; };
     1156                6BE969C71E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp */; };
     1157                6BE969CA1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */; };
     1158                6BE969CB1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */; };
     1159                6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h */; };
    11541160                6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11551161                728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; };
     
    33433349                65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; };
    33443350                65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; };
     3351                6B2E09B91E57B88100C8A8B9 /* CorePredictionSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePredictionSoftLink.h; sourceTree = "<group>"; };
    33453352                6BE9699B1E43B3FF008B7483 /* WKResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKResourceLoadStatisticsManager.h; sourceTree = "<group>"; };
    33463353                6BE9699D1E43B41D008B7483 /* WKResourceLoadStatisticsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKResourceLoadStatisticsManager.cpp; sourceTree = "<group>"; };
    33473354                6BE9699F1E43B86E008B7483 /* WebResourceLoadStatisticsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsManager.h; sourceTree = "<group>"; };
    33483355                6BE969A11E43B8A4008B7483 /* WebResourceLoadStatisticsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsManager.cpp; sourceTree = "<group>"; };
     3356                6BE969C01E54D452008B7483 /* corePrediction_model */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = corePrediction_model; sourceTree = "<group>"; };
     3357                6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadStatisticsClassifier.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 /* ResourceLoadStatisticsClassifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsClassifier.h; sourceTree = "<group>"; };
    33493361                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>"; };
    33503362                6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; };
     
    43654377                        isa = PBXGroup;
    43664378                        children = (
     4379                                6BE969BF1E54D452008B7483 /* ResourceLoadStatistics */,
    43674380                                37F8C94F1AE22BD8007DAB9E /* mac */,
    43684381                                7CB16FE11724B9B5007A0A95 /* PlugInSandboxProfiles */,
     
    61306143                        sourceTree = "<group>";
    61316144                };
     6145                6BE969BF1E54D452008B7483 /* ResourceLoadStatistics */ = {
     6146                        isa = PBXGroup;
     6147                        children = (
     6148                                6BE969C01E54D452008B7483 /* corePrediction_model */,
     6149                        );
     6150                        name = ResourceLoadStatistics;
     6151                        path = Resources/ResourceLoadStatistics;
     6152                        sourceTree = "<group>";
     6153                };
     6154                6BE969C21E54D467008B7483 /* classifier */ = {
     6155                        isa = PBXGroup;
     6156                        children = (
     6157                                6BE969C31E54D467008B7483 /* cocoa */,
     6158                                6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp */,
     6159                                6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h */,
     6160                        );
     6161                        path = classifier;
     6162                        sourceTree = "<group>";
     6163                };
     6164                6BE969C31E54D467008B7483 /* cocoa */ = {
     6165                        isa = PBXGroup;
     6166                        children = (
     6167                                6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */,
     6168                                6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */,
     6169                                6B2E09B91E57B88100C8A8B9 /* CorePredictionSoftLink.h */,
     6170                        );
     6171                        path = cocoa;
     6172                        sourceTree = "<group>";
     6173                };
    61326174                6EE849C41368D9040038D481 /* mac */ = {
    61336175                        isa = PBXGroup;
     
    70317073                        isa = PBXGroup;
    70327074                        children = (
     7075                                6BE969C21E54D467008B7483 /* classifier */,
    70337076                                3709504118A88BA40087AE5D /* cf */,
    70347077                                1AA2E51A12E4C05600BC4966 /* cg */,
     
    79147957                                7C1BA33E1A4A0E600043E249 /* APIDictionary.h in Headers */,
    79157958                                1F7D36C118DA513F00D9D659 /* APIDownloadClient.h in Headers */,
     7959                                6BE969CB1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h in Headers */,
    79167960                                516A4A5D120A2CCD00C05B7F /* APIError.h in Headers */,
    79177961                                317FE7C51C487A6C00A0CA89 /* APIExperimentalFeature.h in Headers */,
     
    84218465                                7C4694D11A51E36800AD5845 /* WebPasteboardProxy.h in Headers */,
    84228466                                7C4694CA1A4B4EA100AD5845 /* WebPasteboardProxyMessages.h in Headers */,
     8467                                6B2E09BA1E57B88100C8A8B9 /* CorePredictionSoftLink.h in Headers */,
    84238468                                1AB1F7971D1B3613007C9BD1 /* WebPaymentCoordinatorMessages.h in Headers */,
    84248469                                1AB1F78C1D1B3355007C9BD1 /* WebPaymentCoordinatorProxy.h in Headers */,
     
    85398584                                1AB474D8184D43FD0051B622 /* WKBundlePageLoaderClient.h in Headers */,
    85408585                                ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */,
     8586                                6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */,
    85418587                                1AB474EA184D45130051B622 /* WKBundlePagePolicyClient.h in Headers */,
    85428588                                BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */,
     
    90729118                                8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
    90739119                                93A2A3461D246125002B59D3 /* mediaIcon.pdf in Resources */,
     9120                                6BE969C11E54D452008B7483 /* corePrediction_model in Resources */,
    90749121                        );
    90759122                        runOnlyForDeploymentPostprocessing = 0;
     
    96599706                                5163199416289A6000E22F00 /* NetworkProcessMessageReceiver.cpp in Sources */,
    96609707                                E14A954916E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp in Sources */,
     9708                                6BE969CA1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp in Sources */,
    96619709                                5179556D162877B100FA43B6 /* NetworkProcessProxy.cpp in Sources */,
    96629710                                516319921628980A00E22F00 /* NetworkProcessProxyMac.mm in Sources */,
     
    1000310051                                BCC43AC7127B99DE00317F16 /* WebPopupMenuMac.mm in Sources */,
    1000410052                                BC5750981268F3C6006F0F12 /* WebPopupMenuProxyMac.mm in Sources */,
     10053                                6BE969C71E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp in Sources */,
    1000510054                                BCD59800112B57BE00EC8C23 /* WebPreferences.cpp in Sources */,
    1000610055                                7C85FD7F19341665000177C4 /* WebPreferencesKeys.cpp in Sources */,
  • trunk/Tools/ChangeLog

    r212945 r212949  
     12017-02-24  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        <rdar://problem/30646710>
     7        <rdar://problem/30660708>
     8
     9        Reviewed by Alex Christensen.
     10
     11        Added three testRunner functions to facilitate layout tests:
     12        - setStatisticsSubframeUnderTopFrameOrigin()
     13        - setStatisticsSubresourceUnderTopFrameOrigin()
     14        - setStatisticsSubresourceUniqueRedirectTo()
     15
     16        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     17        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     18        (WTR::TestRunner::setStatisticsSubframeUnderTopFrameOrigin):
     19        (WTR::TestRunner::setStatisticsSubresourceUnderTopFrameOrigin):
     20        (WTR::TestRunner::setStatisticsSubresourceUniqueRedirectTo):
     21        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     22        * WebKitTestRunner/TestController.cpp:
     23        (WTR::TestController::setStatisticsSubframeUnderTopFrameOrigin):
     24        (WTR::TestController::setStatisticsSubresourceUnderTopFrameOrigin):
     25        (WTR::TestController::setStatisticsSubresourceUniqueRedirectTo):
     26        * WebKitTestRunner/TestController.h:
     27        * WebKitTestRunner/TestInvocation.cpp:
     28        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
     29
    1302017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
    231
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r212841 r212949  
    254254    void setStatisticsHasHadUserInteraction(DOMString hostName, boolean value);
    255255    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);
    256259    void setStatisticsTimeToLiveUserInteraction(double seconds);
    257260    void statisticsFireDataModificationHandler();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r212841 r212949  
    12271227}
    12281228
     1229void TestRunner::setStatisticsSubframeUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName)
     1230{
     1231    Vector<WKRetainPtr<WKStringRef>> keys;
     1232    Vector<WKRetainPtr<WKTypeRef>> values;
     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   
     1240    Vector<WKStringRef> rawKeys(keys.size());
     1241    Vector<WKTypeRef> rawValues(values.size());
     1242   
     1243    for (size_t i = 0; i < keys.size(); ++i) {
     1244        rawKeys[i] = keys[i].get();
     1245        rawValues[i] = values[i].get();
     1246    }
     1247   
     1248    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsSubframeUnderTopFrameOrigin"));
     1249    WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
     1250    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
     1251}
     1252
     1253void TestRunner::setStatisticsSubresourceUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName)
     1254{
     1255    Vector<WKRetainPtr<WKStringRef>> keys;
     1256    Vector<WKRetainPtr<WKTypeRef>> values;
     1257   
     1258    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") });
     1259    values.append({ AdoptWK, WKStringCreateWithJSString(hostName) });
     1260   
     1261    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("TopFrameHostName") });
     1262    values.append({ AdoptWK, WKStringCreateWithJSString(topFrameHostName) });
     1263   
     1264    Vector<WKStringRef> rawKeys(keys.size());
     1265    Vector<WKTypeRef> rawValues(values.size());
     1266   
     1267    for (size_t i = 0; i < keys.size(); ++i) {
     1268        rawKeys[i] = keys[i].get();
     1269        rawValues[i] = values[i].get();
     1270    }
     1271   
     1272    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsSubresourceUnderTopFrameOrigin"));
     1273    WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
     1274    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
     1275}
     1276
     1277void TestRunner::setStatisticsSubresourceUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo)
     1278{
     1279    Vector<WKRetainPtr<WKStringRef>> keys;
     1280    Vector<WKRetainPtr<WKTypeRef>> values;
     1281   
     1282    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") });
     1283    values.append({ AdoptWK, WKStringCreateWithJSString(hostName) });
     1284   
     1285    keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostNameRedirectedTo") });
     1286    values.append({ AdoptWK, WKStringCreateWithJSString(hostNameRedirectedTo) });
     1287   
     1288    Vector<WKStringRef> rawKeys(keys.size());
     1289    Vector<WKTypeRef> rawValues(values.size());
     1290   
     1291    for (size_t i = 0; i < keys.size(); ++i) {
     1292        rawKeys[i] = keys[i].get();
     1293        rawValues[i] = values[i].get();
     1294    }
     1295   
     1296    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsSubresourceUniqueRedirectTo"));
     1297    WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
     1298    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
     1299}
     1300
    12291301void TestRunner::setStatisticsTimeToLiveUserInteraction(double seconds)
    12301302{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r212841 r212949  
    355355    void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value);
    356356    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);
    357360    void setStatisticsTimeToLiveUserInteraction(double seconds);
    358361    void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r212878 r212949  
    22302230}
    22312231
     2232void TestController::setStatisticsSubframeUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName)
     2233{
     2234    WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin(hostName, topFrameHostName);
     2235}
     2236
     2237void TestController::setStatisticsSubresourceUnderTopFrameOrigin(WKStringRef hostName, WKStringRef topFrameHostName)
     2238{
     2239    WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin(hostName, topFrameHostName);
     2240}
     2241   
     2242void TestController::setStatisticsSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo)
     2243{
     2244    WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(hostName, hostNameRedirectedTo);
     2245}
     2246
    22322247void TestController::setStatisticsTimeToLiveUserInteraction(double seconds)
    22332248{
  • trunk/Tools/WebKitTestRunner/TestController.h

    r212841 r212949  
    153153    void setStatisticsHasHadUserInteraction(WKStringRef hostName, bool value);
    154154    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);
    155158    void setStatisticsTimeToLiveUserInteraction(double seconds);
    156159    void statisticsFireDataModificationHandler();
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r212841 r212949  
    933933    }
    934934   
     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
    935977    if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsTimeToLiveUserInteraction")) {
    936978        ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID());
Note: See TracChangeset for help on using the changeset viewer.