Title: [219855] trunk/Source/WebKit
Revision
219855
Author
[email protected]
Date
2017-07-24 20:07:26 -0700 (Mon, 24 Jul 2017)

Log Message

[WK2][Cocoa] Allow overriding the ITP data removal internal using a default
https://bugs.webkit.org/show_bug.cgi?id=174802
<rdar://problem/33497898>

Reviewed by Sam Weinig.

Allow overriding the ITP data removal internal using a default to facilitate testing.
Can be used like so:
defaults write -g ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval 60

Will cause us to write every 60 seconds instead of 3600.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
(WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (219854 => 219855)


--- trunk/Source/WebKit/ChangeLog	2017-07-25 01:58:24 UTC (rev 219854)
+++ trunk/Source/WebKit/ChangeLog	2017-07-25 03:07:26 UTC (rev 219855)
@@ -1,3 +1,21 @@
+2017-07-24  Chris Dumez  <[email protected]>
+
+        [WK2][Cocoa] Allow overriding the ITP data removal internal using a default
+        https://bugs.webkit.org/show_bug.cgi?id=174802
+        <rdar://problem/33497898>
+
+        Reviewed by Sam Weinig.
+
+        Allow overriding the ITP data removal internal using a default to facilitate testing.
+        Can be used like so:
+        defaults write -g ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval 60
+
+        Will cause us to write every 60 seconds instead of 3600.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
+        (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
+
 2017-07-24  Simon Fraser  <[email protected]>
 
         [iOS WK2] Crash under PageOverlayController::uninstallPageOverlay when doing multiple finds

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h (219854 => 219855)


--- trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h	2017-07-25 01:58:24 UTC (rev 219854)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefinitions.h	2017-07-25 03:07:26 UTC (rev 219855)
@@ -304,10 +304,6 @@
     macro(LayoutInterval, layoutInterval, Double, double, -1, "", "") \
     macro(MaxParseDuration, maxParseDuration, Double, double, -1, "", "") \
     macro(PasswordEchoDuration, passwordEchoDuration, Double, double, 2, "", "") \
-    macro(ResourceLoadStatisticsTimeToLiveUserInteraction, resourceLoadStatisticsTimeToLiveUserInteraction, Double, double, 2592000, "", "") \
-    macro(ResourceLoadStatisticsTimeToLiveCookiePartitionFree, resourceLoadStatisticsTimeToLiveCookiePartitionFree, Double, double, 86400, "", "") \
-    macro(ResourceLoadStatisticsReducedTimestampResolution, resourceLoadStatisticsReducedTimestampResolution, Double, double, 3600, "", "") \
-    macro(ResourceLoadStatisticsGrandfatheringTime, resourceLoadStatisticsGrandfatheringTime, Double, double, 3600, "", "") \
 \
 
 #define FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm (219854 => 219855)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm	2017-07-25 01:58:24 UTC (rev 219854)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm	2017-07-25 03:07:26 UTC (rev 219855)
@@ -26,10 +26,6 @@
 #include "config.h"
 #import "WebResourceLoadStatisticsStore.h"
 
-#import "WebPreferencesKeys.h"
-
-using namespace WebCore;
-
 namespace WebKit {
 
 void WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded()
@@ -37,20 +33,21 @@
     static dispatch_once_t initOnce;
 
     dispatch_once(&initOnce, ^ {
-        const size_t hourInSeconds = 3600;
-        const size_t dayInSeconds = 24 * hourInSeconds;
+        Seconds timeToLiveUserInteraction([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsTimeToLiveUserInteraction"]);
+        if (timeToLiveUserInteraction > 0_s && timeToLiveUserInteraction <= 24_h * 30)
+            setTimeToLiveUserInteraction(timeToLiveUserInteraction);
 
-        double timeToLiveUserInteraction = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsTimeToLiveUserInteractionKey()];
-        if (timeToLiveUserInteraction > 0 && timeToLiveUserInteraction <= 30 * dayInSeconds)
-            setTimeToLiveUserInteraction(Seconds { timeToLiveUserInteraction });
+        Seconds timeToLiveCookiePartitionFree([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsTimeToLiveCookiePartitionFree"]);
+        if (timeToLiveCookiePartitionFree > 0_s && timeToLiveCookiePartitionFree <= 24_h)
+            setTimeToLiveCookiePartitionFree(timeToLiveCookiePartitionFree);
 
-        double timeToLiveCookiePartitionFree = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsTimeToLiveCookiePartitionFreeKey()];
-        if (timeToLiveCookiePartitionFree > 0 && timeToLiveCookiePartitionFree <= dayInSeconds)
-            setTimeToLiveCookiePartitionFree(Seconds { timeToLiveCookiePartitionFree });
+        Seconds minimumTimeBetweenDataRecordsRemoval([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval"]);
+        if (minimumTimeBetweenDataRecordsRemoval > 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h)
+            setMinimumTimeBetweenDataRecordsRemoval(minimumTimeBetweenDataRecordsRemoval);
 
-        double grandfatheringTime = [[NSUserDefaults standardUserDefaults] doubleForKey: WebPreferencesKey::resourceLoadStatisticsGrandfatheringTimeKey()];
-        if (grandfatheringTime > 0 && grandfatheringTime <= 7 * dayInSeconds)
-            setGrandfatheringTime(Seconds { grandfatheringTime });
+        Seconds grandfatheringTime([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsGrandfatheringTime"]);
+        if (grandfatheringTime > 0_s && grandfatheringTime <= 24_h * 7)
+            setGrandfatheringTime(grandfatheringTime);
     });
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to