[WK2] Use a rolling 30-day uptime for processing statistics
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Jul 2017 00:07:13 +0000 (00:07 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Jul 2017 00:07:13 +0000 (00:07 +0000)
commit1f56b1295c58270032c07a43131aca4662418c40
treecd7dd2e825673d5f1b0d1031e0def48cbcefc5df
parent0daf974058013b7a86edd53ed89e8b2e570748c9
[WK2] Use a rolling 30-day uptime for processing statistics
https://bugs.webkit.org/show_bug.cgi?id=174235
<rdar://problem/33164381>

Reviewed by Chris Dumez.

Source/WebCore:

Add a KeyedDecoder specialization for Deque.

* platform/KeyedCoding.h:
(WebCore::KeyedDecoder::decodeObjects):

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebsiteDataStore.cpp:
(WebKit::WKWebsiteDataStore::_resourceLoadStatisticsResetToConsistentState): Initialize time-to-live to zero by default.
* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::createEncoderFromData): Write out vector
of operating dates.
(WebKit::ResourceLoadStatisticsStore::readDataFromDecoder): Read in vector of
operating dates.
(WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction): Check new
convenience method.
(WebKit::ResourceLoadStatisticsStore::markTodayAsOperatingDate): Added.
(WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired): Added.
* UIProcess/Storage/ResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): When reading
a new data file, update the current operating date (if needed).
(WebKit::WebResourceLoadStatisticsStore::handleDailyTasks): Roll uptime dates as
needed, then handle telemetry.
* UIProcess/WebResourceLoadStatisticsStore.h:

Source/WTF:

Modify Deque to allow it to be used in a template specialization in KeyedDecoder.

* wtf/Deque.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Deque.h
Source/WebCore/ChangeLog
Source/WebCore/platform/KeyedCoding.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h