Index: components/history/core/browser/thumbnail_database.h |
diff --git a/components/history/core/browser/thumbnail_database.h b/components/history/core/browser/thumbnail_database.h |
index ec21369d43830d0025471da7bfc3c42dd1803a0d..06873fe335e5e758b4777bb6580d2363cb384b7d 100644 |
--- a/components/history/core/browser/thumbnail_database.h |
+++ b/components/history/core/browser/thumbnail_database.h |
@@ -101,6 +101,23 @@ class ThumbnailDatabase { |
base::Time time, |
const gfx::Size& pixel_size); |
+ // The same as AddFaviconBitmap(), it also marks the bitmap as "on-demand". |
+ // |
+ // On-demand bitmaps are those that are fetched without visiting their page. |
+ // For this reason, their life-time cannot be bound to the life-time of the |
+ // corresponding visit in history. |
+ // - These bitmaps are evicted from the database based on the last time they |
+ // get requested. The last requested time is initially set to |time| and is |
+ // further updated by calling KeepOnDemandFavicon(). |
+ // - Furthermore, on-demand bitmaps are immediately marked as expired. Hence, |
+ // they are always replaced by standard favicons whenever their page gets |
+ // visited. |
+ FaviconBitmapID AddOnDemandFaviconBitmap( |
+ favicon_base::FaviconID icon_id, |
+ const scoped_refptr<base::RefCountedMemory>& icon_data, |
+ base::Time time, |
+ const gfx::Size& pixel_size); |
+ |
// Sets the bitmap data and the last updated time for the favicon bitmap at |
// |bitmap_id|. |
// Returns true if successful. |
@@ -113,11 +130,6 @@ class ThumbnailDatabase { |
bool SetFaviconBitmapLastUpdateTime(FaviconBitmapID bitmap_id, |
base::Time time); |
- // Sets the last requested time for the favicon bitmap at |bitmap_id|. |
- // Returns true if successful. |
- bool SetFaviconBitmapLastRequestedTime(FaviconBitmapID bitmap_id, |
- base::Time time); |
- |
// Deletes the favicon bitmap with |bitmap_id|. |
// Returns true if successful. |
bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); |
@@ -128,6 +140,16 @@ class ThumbnailDatabase { |
// of the bitmaps for |icon_id| to be out of date. |
bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); |
+ // Mark all on-demand bitmaps at |icon_url| as requested at |time|. This |
+ // postpones their automatic eviction from the database. Not all calls end up |
+ // in a write into the DB: |
+ // - it is no-op if the bitmaps are not stored using SetOnDemandFaviconBitmap; |
+ // - the updates of the last requested time have limited frequency for each |
+ // particular bitmap (e.g. once per week). This limits the overhead of |
+ // cache management for on-demand favicons. |
+ // Returns true if successful. |
+ bool TouchOnDemandFavicon(const GURL& icon_url, base::Time time); |
+ |
// Returns the id of the entry in the favicon database with the specified url |
// and icon type. |
// Returns 0 if no entry exists for the specified url. |