Title: [127621] releases/WebKitGTK/webkit-1.10/Source/WebCore
Revision
127621
Author
carlo...@webkit.org
Date
2012-09-05 11:54:28 -0700 (Wed, 05 Sep 2012)

Log Message

Merge r126551 - [GTK] Purge unused favicons from IconDatabase after 30 days
https://bugs.webkit.org/show_bug.cgi?id=82346

Reviewed by Gustavo Noronha Silva.

Favicons will be removed from the icon database after not being used
for more than 30 days. This will keep the database size under
control.

* loader/icon/IconDatabase.cpp:
(WebCore):
(WebCore::IconDatabase::performURLImport): filter icons older than
30 days.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog (127620 => 127621)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-05 18:53:29 UTC (rev 127620)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/ChangeLog	2012-09-05 18:54:28 UTC (rev 127621)
@@ -1,3 +1,19 @@
+2012-08-24  Sergio Villar Senin  <svil...@igalia.com>
+
+        [GTK] Purge unused favicons from IconDatabase after 30 days
+        https://bugs.webkit.org/show_bug.cgi?id=82346
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Favicons will be removed from the icon database after not being used
+        for more than 30 days. This will keep the database size under
+        control.
+
+        * loader/icon/IconDatabase.cpp:
+        (WebCore):
+        (WebCore::IconDatabase::performURLImport): filter icons older than
+        30 days.
+
 2012-09-04  Joanmarie Diggs  <jdi...@igalia.com>
 
         [GTK] Crash in AccessibilityObject::accessibilityPlatformIncludesObject()

Modified: releases/WebKitGTK/webkit-1.10/Source/WebCore/loader/icon/IconDatabase.cpp (127620 => 127621)


--- releases/WebKitGTK/webkit-1.10/Source/WebCore/loader/icon/IconDatabase.cpp	2012-09-05 18:53:29 UTC (rev 127620)
+++ releases/WebKitGTK/webkit-1.10/Source/WebCore/loader/icon/IconDatabase.cpp	2012-09-05 18:54:28 UTC (rev 127621)
@@ -73,6 +73,12 @@
 
 static bool checkIntegrityOnOpen = false;
 
+#if PLATFORM(GTK)
+// We are not interested in icons that have been unused for more than
+// 30 days, delete them even if they have not been explicitly released.
+static const int notUsedIconExpirationTime = 60*60*24*30;
+#endif
+
 #if !LOG_DISABLED || !ERROR_DISABLED
 static String urlForLogging(const String& url)
 {
@@ -1257,7 +1263,17 @@
 {
     ASSERT_ICON_SYNC_THREAD();
 
-    SQLiteStatement query(m_syncDB, "SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID;");
+# if PLATFORM(GTK)
+    // Do not import icons not used in the last 30 days. They will be automatically pruned later if nobody retains them.
+    // Note that IconInfo.stamp is only set when the icon data is retrieved from the server (and thus is not updated whether
+    // we use it or not). This code works anyway because the IconDatabase downloads icons again if they are older than 4 days,
+    // so if the timestamp goes back in time more than those 30 days we can be sure that the icon was not used at all.
+    String importQuery = String::format("SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID WHERE IconInfo.stamp > %.0f;", floor(currentTime() - notUsedIconExpirationTime));
+#else
+    String importQuery("SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID;");
+#endif
+
+    SQLiteStatement query(m_syncDB, importQuery);
     
     if (query.prepare() != SQLResultOk) {
         LOG_ERROR("Unable to prepare icon url import query");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to