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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/favicon/core/favicon_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 6 #define COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is 132 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is
133 // returned. 133 // returned.
134 virtual base::CancelableTaskTracker::TaskId GetLargestRawFaviconForID( 134 virtual base::CancelableTaskTracker::TaskId GetLargestRawFaviconForID(
135 favicon_base::FaviconID favicon_id, 135 favicon_base::FaviconID favicon_id,
136 const favicon_base::FaviconRawBitmapCallback& callback, 136 const favicon_base::FaviconRawBitmapCallback& callback,
137 base::CancelableTaskTracker* tracker) = 0; 137 base::CancelableTaskTracker* tracker) = 0;
138 138
139 // Marks all types of favicon for the page as being out of date. 139 // Marks all types of favicon for the page as being out of date.
140 virtual void SetFaviconOutOfDateForPage(const GURL& page_url) = 0; 140 virtual void SetFaviconOutOfDateForPage(const GURL& page_url) = 0;
141 141
142 // Mark that the on-demand favicon at |icon_url| was requested now. This
143 // postpones the automatic eviction of the favicon from the database. Not all
144 // calls end up in a write into the DB:
145 // - It is no-op if the bitmaps are not stored using SetOnDemandFavicons().
146 // - The updates of the "last requested time" have limited frequency for each
147 // particular favicon (e.g. once per week). This limits the overhead of
148 // cache management for on-demand favicons.
149 virtual void TouchOnDemandFavicon(const GURL& icon_url) = 0;
150
142 // Allows the importer to set many favicons for many pages at once. The pages 151 // Allows the importer to set many favicons for many pages at once. The pages
143 // must exist, any favicon sets for unknown pages will be discarded. Existing 152 // must exist, any favicon sets for unknown pages will be discarded. Existing
144 // favicons will not be overwritten. 153 // favicons will not be overwritten.
145 virtual void SetImportedFavicons( 154 virtual void SetImportedFavicons(
146 const favicon_base::FaviconUsageDataList& favicon_usage) = 0; 155 const favicon_base::FaviconUsageDataList& favicon_usage) = 0;
147 156
148 // Set the favicon for |page_url| for |icon_type| in the thumbnail database. 157 // Set the favicon for |page_url| for |icon_type| in the thumbnail database.
149 // Unlike SetFavicons(), this method will not delete preexisting bitmap data 158 // Unlike SetFavicons(), this method will not delete preexisting bitmap data
150 // which is associated to |page_url| if at all possible. Use this method if 159 // which is associated to |page_url| if at all possible. Use this method if
151 // the favicon bitmaps for any of ui::GetSupportedScaleFactors() are not 160 // the favicon bitmaps for any of ui::GetSupportedScaleFactors() are not
(...skipping 12 matching lines...) Expand all
164 // contains image reps for all of ui::GetSupportedScaleFactors(). Use 173 // contains image reps for all of ui::GetSupportedScaleFactors(). Use
165 // MergeFavicon() if it does not. 174 // MergeFavicon() if it does not.
166 // TODO(pkotwicz): Save unresized favicon bitmaps to the database. 175 // TODO(pkotwicz): Save unresized favicon bitmaps to the database.
167 // TODO(pkotwicz): Support adding favicons for multiple icon URLs to the 176 // TODO(pkotwicz): Support adding favicons for multiple icon URLs to the
168 // thumbnail database. 177 // thumbnail database.
169 virtual void SetFavicons(const GURL& page_url, 178 virtual void SetFavicons(const GURL& page_url,
170 const GURL& icon_url, 179 const GURL& icon_url,
171 favicon_base::IconType icon_type, 180 favicon_base::IconType icon_type,
172 const gfx::Image& image) = 0; 181 const gfx::Image& image) = 0;
173 182
174 // Same as SetFavicons() with three differences: 183 // Same as SetFavicons with three differences:
175 // 1) It will be a no-op if there is an existing cached favicon for *any* type 184 // 1) It will be a no-op if there is an existing cached favicon for *any* type
176 // for |page_url|. 185 // for |page_url|.
177 // 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e. 186 // 2) If |icon_url| is known to the database, |bitmaps| will be ignored (i.e.
178 // the icon won't be overwritten) but the mappings from |page_url| to 187 // the icon won't be overwritten) but the mappings from |page_url| to
179 // |icon_url| will be stored (conditioned to point 1 above). 188 // |icon_url| will be stored (conditioned to point 1 above).
180 // 3) If |icon_url| is stored, it will be marked as expired. 189 // 3) If |icon_url| is stored, it will be marked as "on-demand".
190 //
191 // On-demand favicons are those that are fetched without visiting their page.
192 // For this reason, their life-time cannot be bound to the life-time of the
193 // corresponding visit in history.
194 // - These bitmaps are evicted from the database based on the last time they
195 // get requested. The last requested time is initially set to Now() and is
196 // further updated by calling TouchOnDemandFavicon().
197 // - Furthermore, on-demand bitmaps are immediately marked as expired. Hence,
198 // they are always replaced by standard favicons whenever their page gets
199 // visited.
181 // The callback will receive whether the write actually happened. 200 // The callback will receive whether the write actually happened.
182 virtual void SetLastResortFavicons(const GURL& page_url, 201 virtual void SetOnDemandFavicons(const GURL& page_url,
183 const GURL& icon_url, 202 const GURL& icon_url,
184 favicon_base::IconType icon_type, 203 favicon_base::IconType icon_type,
185 const gfx::Image& image, 204 const gfx::Image& image,
186 base::Callback<void(bool)> callback) = 0; 205 base::Callback<void(bool)> callback) = 0;
187 206
188 // Avoid repeated requests to download missing favicon. 207 // Avoid repeated requests to download missing favicon.
189 virtual void UnableToDownloadFavicon(const GURL& icon_url) = 0; 208 virtual void UnableToDownloadFavicon(const GURL& icon_url) = 0;
190 virtual bool WasUnableToDownloadFavicon(const GURL& icon_url) const = 0; 209 virtual bool WasUnableToDownloadFavicon(const GURL& icon_url) const = 0;
191 virtual void ClearUnableToDownloadFavicons() = 0; 210 virtual void ClearUnableToDownloadFavicons() = 0;
192 }; 211 };
193 212
194 } // namespace favicon 213 } // namespace favicon
195 214
196 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 215 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
OLDNEW
« 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