Update Resource Load Statistics
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 17:40:12 +0000 (17:40 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Oct 2016 17:40:12 +0000 (17:40 +0000)
commit54a5bb651207c3703e731d8c31884ea842e187b7
treeca9cd21d7d49afdc43c14e3020d2fbb3b7f4d4a8
parenta3e1d33c53405fdd2eb9d828ba170f1f03496909
Update Resource Load Statistics
https://bugs.webkit.org/show_bug.cgi?id=162811

Reviewed by Alex Christensen.

Source/WebCore:

No new tests. The counting is based on top privately owned domains
which currently is not supported by layout tests nor API tests.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
    Now captures statistics for web sockets too.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/ResourceLoadObserver.cpp:
    Now captures statistics for synchronous XHR too.
(WebCore::is3xxRedirect):
    Convenience function.
(WebCore::ResourceLoadObserver::shouldLog):
    Convenience function.
(WebCore::ResourceLoadObserver::logFrameNavigation):
    Updated to make use of new convenience functions.
(WebCore::ResourceLoadObserver::logSubresourceLoading):
    Updated to make use of new convenience functions.
(WebCore::ResourceLoadObserver::logWebSocketLoading):
    Added.
(WebCore::ResourceLoadObserver::logUserInteraction):
    Updated to make use of new convenience functions.
(WebCore::ResourceLoadObserver::primaryDomain):
    Now makes use of the Public Suffix list.
    Removed old custom parsing of primary domain.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
    Convenience function.
(WebCore::ResourceLoadStatisticsStore::processStatistics): Deleted.
* loader/ResourceLoadStatisticsStore.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
    Moved logging call higher up and added a check for whether we
    are loading the main resource. The reason for moving it up is
    to capture the request before some data may be cleared out in
    redirect handling. We also want to capture failed CORS requests
    since they are sent and then cancelled on the way back.

Source/WebKit2:

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::hasPrevalentResourceCharacteristics):
    Switched to vector-based classification.
(WebKit::WebResourceLoadStatisticsStore::classifyResource):
    Simplified logic and moved the split between has and has
    no user interaction into ResourceLoadStatisticsStore.
(WebKit::WebResourceLoadStatisticsStore::clearDataRecords):
    Added.
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
    Updated to make use of the new functions.
(WebKit::WebResourceLoadStatisticsStore::persistentStoragePath):
    Removed stray whitespace.
(WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
    Removed stray whitespace.
(WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk):
    Removed stray whitespace.
(WebKit::hasPrevalentResourceCharacteristics): Deleted.
(WebKit::classifyPrevalentResources): Deleted.
* UIProcess/WebResourceLoadStatisticsStore.h:
    Added member variables for clearing of data records.

Tools:

* TestWebKitAPI/Tests/mac/PublicSuffix.mm:
    Change from USE(PUBLIC_SUFFIX_LIST) to ENABLE(PUBLIC_SUFFIX_LIST)

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadObserver.h
Source/WebCore/loader/ResourceLoadStatisticsStore.cpp
Source/WebCore/loader/ResourceLoadStatisticsStore.h
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/mac/PublicSuffix.mm