Title: [219275] trunk/Source/WebKit2
- Revision
- 219275
- Author
- [email protected]
- Date
- 2017-07-07 22:09:55 -0700 (Fri, 07 Jul 2017)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (219274 => 219275)
--- trunk/Source/WebKit2/ChangeLog 2017-07-08 00:07:13 UTC (rev 219274)
+++ trunk/Source/WebKit2/ChangeLog 2017-07-08 05:09:55 UTC (rev 219275)
@@ -1,3 +1,27 @@
+2017-07-07 Chris Dumez <[email protected]>
+
+ [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:
+
2017-07-07 Brent Fulgham <[email protected]>
[WK2] Use a rolling 30-day uptime for processing statistics
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (219274 => 219275)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2017-07-08 00:07:13 UTC (rev 219274)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm 2017-07-08 05:09:55 UTC (rev 219275)
@@ -440,7 +440,8 @@
if (!store)
return;
- store->setTimeToLiveUserInteraction(0_s);
+ // FIXME: These needs to match the default data member values in ResourceLoadStatistics, which is fragile.
+ store->setTimeToLiveUserInteraction(std::nullopt);
store->setTimeToLiveCookiePartitionFree(24_h);
store->setMinimumTimeBetweenDataRecordsRemoval(1_h);
store->setGrandfatheringTime(1_h);
Modified: trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp (219274 => 219275)
--- trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp 2017-07-08 00:07:13 UTC (rev 219274)
+++ trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp 2017-07-08 05:09:55 UTC (rev 219275)
@@ -275,9 +275,9 @@
ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookiePartitioning = true;
}
-void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds)
+void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(std::optional<Seconds> seconds)
{
- ASSERT(seconds >= 0_s);
+ ASSERT(!seconds || seconds.value() >= 0_s);
m_timeToLiveUserInteraction = seconds;
}
@@ -443,7 +443,7 @@
// If we don't meet the real criteria for an expired statistic, check the user
// setting for a tighter restriction (mainly for testing).
if (m_timeToLiveUserInteraction) {
- if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime + m_timeToLiveUserInteraction)
+ if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime + m_timeToLiveUserInteraction.value())
return true;
}
Modified: trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h (219274 => 219275)
--- trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h 2017-07-08 00:07:13 UTC (rev 219274)
+++ trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.h 2017-07-08 05:09:55 UTC (rev 219275)
@@ -81,7 +81,7 @@
void fireDataModificationHandler();
void fireTelemetryHandler();
- void setTimeToLiveUserInteraction(Seconds);
+ void setTimeToLiveUserInteraction(std::optional<Seconds>);
void setTimeToLiveCookiePartitionFree(Seconds);
void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
void setGrandfatheringTime(Seconds);
@@ -117,7 +117,7 @@
WTF::Function<void()> m_deletePersistentStoreHandler;
WTF::Function<void()> m_fireTelemetryHandler;
- Seconds m_timeToLiveUserInteraction { 0_s };
+ std::optional<Seconds> m_timeToLiveUserInteraction;
Seconds m_timeToLiveCookiePartitionFree { 24_h };
Seconds m_grandfatheringTime { 1_h };
Seconds m_minimumTimeBetweenDataRecordsRemoval { 1_h };
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (219274 => 219275)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-07-08 00:07:13 UTC (rev 219274)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp 2017-07-08 05:09:55 UTC (rev 219275)
@@ -747,7 +747,7 @@
clearInMemoryAndPersistent();
}
-void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds)
+void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(std::optional<Seconds> seconds)
{
coreStore().setTimeToLiveUserInteraction(seconds);
}
Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (219274 => 219275)
--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h 2017-07-08 00:07:13 UTC (rev 219274)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h 2017-07-08 05:09:55 UTC (rev 219275)
@@ -95,7 +95,7 @@
void clearInMemoryAndPersistent();
void clearInMemoryAndPersistent(std::chrono::system_clock::time_point modifiedSince);
- void setTimeToLiveUserInteraction(Seconds);
+ void setTimeToLiveUserInteraction(std::optional<Seconds>);
void setTimeToLiveCookiePartitionFree(Seconds);
void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
void setGrandfatheringTime(Seconds);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes