Resource Load Statistics: Enable cap on partitioned cache max age
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Nov 2018 00:15:59 +0000 (00:15 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Nov 2018 00:15:59 +0000 (00:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191395
<rdar://problem/45885977>

Reviewed by Chris Dumez.

This change does not bump the network cache revision number.
It's not needed since it was done just a week ago.

* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
(WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap):
* UIProcess/ResourceLoadStatisticsMemoryStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237949 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

index bb12df6..20a9b3f 100644 (file)
@@ -1,3 +1,21 @@
+2018-11-07  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Enable cap on partitioned cache max age
+        https://bugs.webkit.org/show_bug.cgi?id=191395
+        <rdar://problem/45885977>
+
+        Reviewed by Chris Dumez.
+
+        This change does not bump the network cache revision number.
+        It's not needed since it was done just a week ago.
+
+        * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+        (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
+        (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap):
+        * UIProcess/ResourceLoadStatisticsMemoryStore.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
+
 2018-11-07  Daniel Bates  <dabates@apple.com>
 
         [iOS] Support deleting to the start of the line and to the end of the line
index 7c9796c..6d99be9 100644 (file)
@@ -835,7 +835,15 @@ void ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap(Seconds seconds)
     ASSERT(!RunLoop::isMain());
     ASSERT(seconds >= 0_s);
 
-    RunLoop::main().dispatch([store = makeRef(m_store), seconds] () {
+    m_parameters.cacheMaxAgeCapTime = seconds;
+    updateCacheMaxAgeCap();
+}
+
+void ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap()
+{
+    ASSERT(!RunLoop::isMain());
+    
+    RunLoop::main().dispatch([store = makeRef(m_store), seconds = m_parameters.cacheMaxAgeCapTime] () {
         store->setCacheMaxAgeCap(seconds, [] { });
     });
 }
index 365ec0e..d2e886e 100644 (file)
@@ -113,6 +113,7 @@ public:
     void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
     void setGrandfatheringTime(Seconds);
     void setCacheMaxAgeCap(Seconds);
+    void updateCacheMaxAgeCap();
     void setResourceLoadStatisticsDebugMode(bool);
     bool isDebugModeEnabled() const { return m_debugModeEnabled; };
     void setPrevalentResourceForDebugMode(const String& domain);
@@ -162,6 +163,7 @@ private:
         std::optional<Seconds> timeToLiveUserInteraction;
         Seconds minimumTimeBetweenDataRecordsRemoval { 1_h };
         Seconds grandfatheringTime { 24_h * 7 };
+        Seconds cacheMaxAgeCapTime { 24_h * 7 };
         bool shouldNotifyPagesWhenDataRecordsWereScanned { false };
         bool shouldClassifyResourcesBeforeDataRecordsRemoval { true };
         bool shouldSubmitTelemetry { true };
index 70e0b99..6ad079d 100644 (file)
@@ -330,6 +330,7 @@ void WebResourceLoadStatisticsStore::didCreateNetworkProcess()
         if (!m_memoryStore)
             return;
         m_memoryStore->updateCookieBlocking([]() { });
+        m_memoryStore->updateCacheMaxAgeCap();
     });
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)