Changeset 126551 in webkit


Ignore:
Timestamp:
Aug 24, 2012 12:45:50 AM (12 years ago)
Author:
sergio@webkit.org
Message:

[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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126548 r126551  
     12012-08-24  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [GTK] Purge unused favicons from IconDatabase after 30 days
     4        https://bugs.webkit.org/show_bug.cgi?id=82346
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Favicons will be removed from the icon database after not being used
     9        for more than 30 days. This will keep the database size under
     10        control.
     11
     12        * loader/icon/IconDatabase.cpp:
     13        (WebCore):
     14        (WebCore::IconDatabase::performURLImport): filter icons older than
     15        30 days.
     16
    1172012-08-23  Sheriff Bot  <webkit.review.bot@gmail.com>
    218
  • trunk/Source/WebCore/loader/icon/IconDatabase.cpp

    r120694 r126551  
    7373
    7474static bool checkIntegrityOnOpen = false;
     75
     76#if PLATFORM(GTK)
     77// We are not interested in icons that have been unused for more than
     78// 30 days, delete them even if they have not been explicitly released.
     79static const int notUsedIconExpirationTime = 60*60*24*30;
     80#endif
    7581
    7682#if !LOG_DISABLED || !ERROR_DISABLED
     
    12581264    ASSERT_ICON_SYNC_THREAD();
    12591265
    1260     SQLiteStatement query(m_syncDB, "SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID;");
     1266# if PLATFORM(GTK)
     1267    // Do not import icons not used in the last 30 days. They will be automatically pruned later if nobody retains them.
     1268    // Note that IconInfo.stamp is only set when the icon data is retrieved from the server (and thus is not updated whether
     1269    // we use it or not). This code works anyway because the IconDatabase downloads icons again if they are older than 4 days,
     1270    // 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.
     1271    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));
     1272#else
     1273    String importQuery("SELECT PageURL.url, IconInfo.url, IconInfo.stamp FROM PageURL INNER JOIN IconInfo ON PageURL.iconID=IconInfo.iconID;");
     1274#endif
     1275
     1276    SQLiteStatement query(m_syncDB, importQuery);
    12611277   
    12621278    if (query.prepare() != SQLResultOk) {
Note: See TracChangeset for help on using the changeset viewer.