Resource load statistics: Cover further data records, count removed data records...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Nov 2016 03:32:53 +0000 (03:32 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Nov 2016 03:32:53 +0000 (03:32 +0000)
commit8e28472238a79d2fb5471d0b127598c94283713b
treee3a822acce4aacc5a36bd35bc04511cf5c495180
parent14c6a90196539a5c68d2fd5df95eee10c46e05ac
Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed
https://bugs.webkit.org/show_bug.cgi?id=164659

Reviewed by Andy Estes.

Source/WebCore:

No new tests. This feature is behind a flag and off by default. Tests require real domain names.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
    All three functions are now more conservative in calls to
    m_store->fireDataModificationHandler(). They only fire when an important statistic has
    changed or data records have previously been removed for the domain in question.
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::encode):
    Added the dataRecordsRemoved statistic.
(WebCore::ResourceLoadStatistics::decode):
    Now takes a version parameter to control which keys to expect.
    Added the dataRecordsRemoved statistic.
(WebCore::appendHashCountedSet):
    Removed stray linefeed.
(WebCore::ResourceLoadStatistics::toString):
    Added the dataRecordsRemoved statistic.
(WebCore::ResourceLoadStatistics::merge):
    Added the dataRecordsRemoved statistic.
* loader/ResourceLoadStatistics.h:
    Added the dataRecordsRemoved statistic.
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
    Now encodes a version number for the statistics model.
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
    Now tries to decode a version number and passes it on to statistics decoding.
(WebCore::ResourceLoadStatisticsStore::processStatistics):
    No longer gates processing on the number of data captured.
(WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
    Update function for the new dataRecordsRemoved statistic.
(WebCore::ResourceLoadStatisticsStore::hasEnoughDataForStatisticsProcessing): Deleted.
    No longer needed since we no longer gate processing on the number of data captured.
* loader/ResourceLoadStatisticsStore.h:

Source/WebKit2:

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
    Consistent naming with 'remove' rather than 'delete'.
    Now removes localStorage, IndexDB, disk cache, and memory cache too.
    Updates statistics with number of times it has removed data records.
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
    No longer checks whether it has enough data since the classification rules
    are absolute, not relative.
(WebKit::WebResourceLoadStatisticsStore::clearDataRecords): Deleted.
* UIProcess/WebResourceLoadStatisticsStore.h:
    Consistent naming with 'remove' rather than 'delete'.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208874 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadObserver.cpp
Source/WebCore/loader/ResourceLoadStatistics.cpp
Source/WebCore/loader/ResourceLoadStatistics.h
Source/WebCore/loader/ResourceLoadStatisticsStore.cpp
Source/WebCore/loader/ResourceLoadStatisticsStore.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h