Changeset 219275 in webkit


Ignore:
Timestamp:
Jul 7, 2017 10:09:55 PM (7 years ago)
Author:
Chris Dumez
Message:

[WK2] Use a rolling 30-day uptime for processing statistics
https://bugs.webkit.org/show_bug.cgi?id=174235
<rdar://problem/33164381>

Reviewed by Brent Fulgham.

Follow-up fix for r219274 because it caused this test to time out:
http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html

The test sets TimeToLiveUserInteraction to 0 so our implementation cannot use
0 as magic value to see if it was set. Instead, use std::optional.

  • UIProcess/API/Cocoa/WKWebsiteDataStore.mm:

(-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):

  • UIProcess/Storage/ResourceLoadStatisticsStore.cpp:

(WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
(WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired):

  • UIProcess/Storage/ResourceLoadStatisticsStore.h:
  • UIProcess/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):

  • UIProcess/WebResourceLoadStatisticsStore.h:
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r219274 r219275  
     12017-07-07  Chris Dumez  <cdumez@apple.com>
     2
     3        [WK2] Use a rolling 30-day uptime for processing statistics
     4        https://bugs.webkit.org/show_bug.cgi?id=174235
     5        <rdar://problem/33164381>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Follow-up fix for r219274 because it caused this test to time out:
     10        http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
     11
     12        The test sets TimeToLiveUserInteraction to 0 so our implementation cannot use
     13        0 as magic value to see if it was set. Instead, use std::optional.
     14
     15        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
     16        (-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
     17        * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
     18        (WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
     19        (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired):
     20        * UIProcess/Storage/ResourceLoadStatisticsStore.h:
     21        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     22        (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
     23        * UIProcess/WebResourceLoadStatisticsStore.h:
     24
    1252017-07-07  Brent Fulgham  <bfulgham@apple.com>
    226
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm

    r219274 r219275  
    441441        return;
    442442
    443     store->setTimeToLiveUserInteraction(0_s);
     443    // FIXME: These needs to match the default data member values in ResourceLoadStatistics, which is fragile.
     444    store->setTimeToLiveUserInteraction(std::nullopt);
    444445    store->setTimeToLiveCookiePartitionFree(24_h);
    445446    store->setMinimumTimeBetweenDataRecordsRemoval(1_h);
  • trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp

    r219274 r219275  
    276276}
    277277
    278 void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds)
    279 {
    280     ASSERT(seconds >= 0_s);
     278void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(std::optional<Seconds> seconds)
     279{
     280    ASSERT(!seconds || seconds.value() >= 0_s);
    281281    m_timeToLiveUserInteraction = seconds;
    282282}
     
    444444    // setting for a tighter restriction (mainly for testing).
    445445    if (m_timeToLiveUserInteraction) {
    446         if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime + m_timeToLiveUserInteraction)
     446        if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime + m_timeToLiveUserInteraction.value())
    447447            return true;
    448448    }
  • trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h

    r219274 r219275  
    8282    void fireDataModificationHandler();
    8383    void fireTelemetryHandler();
    84     void setTimeToLiveUserInteraction(Seconds);
     84    void setTimeToLiveUserInteraction(std::optional<Seconds>);
    8585    void setTimeToLiveCookiePartitionFree(Seconds);
    8686    void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
     
    118118    WTF::Function<void()> m_fireTelemetryHandler;
    119119
    120     Seconds m_timeToLiveUserInteraction { 0_s };
     120    std::optional<Seconds> m_timeToLiveUserInteraction;
    121121    Seconds m_timeToLiveCookiePartitionFree { 24_h };
    122122    Seconds m_grandfatheringTime { 1_h };
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp

    r219274 r219275  
    748748}
    749749
    750 void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds)
     750void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(std::optional<Seconds> seconds)
    751751{
    752752    coreStore().setTimeToLiveUserInteraction(seconds);
  • trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h

    r219274 r219275  
    9696    void clearInMemoryAndPersistent(std::chrono::system_clock::time_point modifiedSince);
    9797
    98     void setTimeToLiveUserInteraction(Seconds);
     98    void setTimeToLiveUserInteraction(std::optional<Seconds>);
    9999    void setTimeToLiveCookiePartitionFree(Seconds);
    100100    void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
Note: See TracChangeset for help on using the changeset viewer.