Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: components/history/core/browser/thumbnail_database.h

Issue 2856873002: [Thumbnails DB] Allow setting last_requested time when accessing favicons. (Closed)
Patch Set: Minor touches Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9f81d41f46daca2f9078e6d7f54a0bd2ea3099dd..d553f35b40b2b228432a8adf494101db006ab1ec 100644
--- a/components/history/core/browser/thumbnail_database.h
+++ b/components/history/core/browser/thumbnail_database.h
@@ -62,6 +62,11 @@ class ThumbnailDatabase {
// true try to trim all unused cache, otherwise trim by half.
void TrimMemory(bool aggressively);
+ // Delete all favicon bitmaps that have not been requested long (i.e. not
+ // after |expiration_threshold|). Furthermore, delete all favicons with no
+ // corresponding bitmap and all mappings with no corresponding favicon.
+ void CleanUnusedFavicons(base::Time expiration_threshold);
+
// Favicon Bitmaps -----------------------------------------------------------
// Returns true if there are favicon bitmaps for |icon_id|. If
@@ -80,10 +85,14 @@ class ThumbnailDatabase {
std::vector<FaviconBitmap>* favicon_bitmaps);
// Gets the last updated time, bitmap data, and pixel size of the favicon
- // bitmap at |bitmap_id|. Returns true if successful.
+ // bitmap at |bitmap_id|. Returns true if successful. The |access_time| is
+ // stored for |bitmap_id| (should be base::Time:Now() in most cases and
+ // base::Time() in incognito profiles to avoid storing the access). The access
+ // times are used to detect that a favicon should be removed if it has not
+ // been used for long.
bool GetFaviconBitmap(FaviconBitmapID bitmap_id,
+ base::Time access_time,
base::Time* last_updated,
- base::Time* last_requested,
scoped_refptr<base::RefCountedMemory>* png_icon_data,
gfx::Size* pixel_size);
@@ -113,11 +122,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);

Powered by Google App Engine
This is Rietveld 408576698