Title: [262538] trunk/Source/WebKit
Revision
262538
Author
[email protected]
Date
2020-06-04 08:03:04 -0700 (Thu, 04 Jun 2020)

Log Message

ITP SQLite Database should only vacuum once per day
https://bugs.webkit.org/show_bug.cgi?id=212712
<rdar://problem/63939711>

Reviewed by Brent Fulgham.

Currently the SQLite Database runs a vacuum command each time statistics
are processed. This is probably too frequent, because the database
rarely needs to delete large amounts of data. We can cut this down to once a day.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::performDailyTasks):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (262537 => 262538)


--- trunk/Source/WebKit/ChangeLog	2020-06-04 14:46:16 UTC (rev 262537)
+++ trunk/Source/WebKit/ChangeLog	2020-06-04 15:03:04 UTC (rev 262538)
@@ -1,3 +1,20 @@
+2020-06-04  Kate Cheney  <[email protected]>
+
+        ITP SQLite Database should only vacuum once per day
+        https://bugs.webkit.org/show_bug.cgi?id=212712
+        <rdar://problem/63939711>
+
+        Reviewed by Brent Fulgham.
+
+        Currently the SQLite Database runs a vacuum command each time statistics
+        are processed. This is probably too frequent, because the database
+        rarely needs to delete large amounts of data. We can cut this down to once a day.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
+
 2020-06-04  Youenn Fablet  <[email protected]>
 
         Minor optimisation to RemoteAudioBusData::decode

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (262537 => 262538)


--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp	2020-06-04 14:46:16 UTC (rev 262537)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp	2020-06-04 15:03:04 UTC (rev 262538)
@@ -1470,18 +1470,12 @@
     reclassifyResources();
 }
 
-void ResourceLoadStatisticsDatabaseStore::syncStorageIfNeeded()
+void ResourceLoadStatisticsDatabaseStore::runVacuumCommand()
 {
     ASSERT(!RunLoop::isMain());
     m_database.runVacuumCommand();
 }
 
-void ResourceLoadStatisticsDatabaseStore::syncStorageImmediately()
-{
-    ASSERT(!RunLoop::isMain());
-    m_database.runVacuumCommand();
-}
-
 bool ResourceLoadStatisticsDatabaseStore::hasStorageAccess(const TopFrameDomain& topFrameDomain, const SubFrameDomain& subFrameDomain) const
 {
     auto scopedStatement = this->scopedStatement(m_storageAccessExistsStatement, storageAccessExistsQuery, "hasStorageAccess"_s);

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h (262537 => 262538)


--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h	2020-06-04 14:46:16 UTC (rev 262537)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h	2020-06-04 15:03:04 UTC (rev 262538)
@@ -93,8 +93,9 @@
     void updateCookieBlocking(CompletionHandler<void()>&&) override;
 
     void classifyPrevalentResources() override;
-    void syncStorageIfNeeded() override;
-    void syncStorageImmediately() override;
+    void syncStorageIfNeeded() override { };
+    void syncStorageImmediately() override { };
+    void runVacuumCommand();
 
     void requestStorageAccessUnderOpener(DomainInNeedOfStorageAccess&&, WebCore::PageIdentifier openerID, OpenerDomain&&) override;
 

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (262537 => 262538)


--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2020-06-04 14:46:16 UTC (rev 262537)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2020-06-04 15:03:04 UTC (rev 262538)
@@ -737,6 +737,8 @@
             m_statisticsStore->includeTodayAsOperatingDateIfNecessary();
             m_statisticsStore->calculateAndSubmitTelemetry();
         }
+        if (is<ResourceLoadStatisticsDatabaseStore>(*m_statisticsStore))
+            downcast<ResourceLoadStatisticsDatabaseStore>(*m_statisticsStore).runVacuumCommand();
     });
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to