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

Unified Diff: components/favicon/core/favicon_service.h

Issue 2856873002: [Thumbnails DB] Allow setting last_requested time when accessing favicons. (Closed)
Patch Set: Peter's comments Created 3 years, 6 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
« no previous file with comments | « no previous file | components/favicon/core/favicon_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_service.h
diff --git a/components/favicon/core/favicon_service.h b/components/favicon/core/favicon_service.h
index d36180093497dc83e2031acae57945ebdfbb56be..60552b13691d278c63fc51c0096a29b147cbfb1d 100644
--- a/components/favicon/core/favicon_service.h
+++ b/components/favicon/core/favicon_service.h
@@ -139,6 +139,15 @@ class FaviconService : public KeyedService {
// Marks all types of favicon for the page as being out of date.
virtual void SetFaviconOutOfDateForPage(const GURL& page_url) = 0;
+ // Mark that the on-demand favicon at |icon_url| was requested now. This
+ // postpones the automatic eviction of the favicon 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 SetOnDemandFavicons().
+ // - The updates of the "last requested time" have limited frequency for each
+ // particular favicon (e.g. once per week). This limits the overhead of
+ // cache management for on-demand favicons.
+ virtual void TouchOnDemandFavicon(const GURL& icon_url) = 0;
+
// Allows the importer to set many favicons for many pages at once. The pages
// must exist, any favicon sets for unknown pages will be discarded. Existing
// favicons will not be overwritten.
@@ -171,19 +180,29 @@ class FaviconService : public KeyedService {
favicon_base::IconType icon_type,
const gfx::Image& image) = 0;
- // Same as SetFavicons() with three differences:
+ // Same as SetFavicons with three differences:
// 1) It will be a no-op if there is an existing cached favicon for *any* type
// for |page_url|.
// 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e.
// the icon won't be overwritten) but the mappings from |page_url| to
// |icon_url| will be stored (conditioned to point 1 above).
- // 3) If |icon_url| is stored, it will be marked as expired.
+ // 3) If |icon_url| is stored, it will be marked as "on-demand".
+ //
+ // On-demand favicons 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 Now() and is
+ // further updated by calling TouchOnDemandFavicon().
+ // - Furthermore, on-demand bitmaps are immediately marked as expired. Hence,
+ // they are always replaced by standard favicons whenever their page gets
+ // visited.
// The callback will receive whether the write actually happened.
- virtual void SetLastResortFavicons(const GURL& page_url,
- const GURL& icon_url,
- favicon_base::IconType icon_type,
- const gfx::Image& image,
- base::Callback<void(bool)> callback) = 0;
+ virtual void SetOnDemandFavicons(const GURL& page_url,
+ const GURL& icon_url,
+ favicon_base::IconType icon_type,
+ const gfx::Image& image,
+ base::Callback<void(bool)> callback) = 0;
// Avoid repeated requests to download missing favicon.
virtual void UnableToDownloadFavicon(const GURL& icon_url) = 0;
« no previous file with comments | « no previous file | components/favicon/core/favicon_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698