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

Side by Side Diff: components/history/core/browser/thumbnail_database.h

Issue 2856873002: [Thumbnails DB] Allow setting last_requested time when accessing favicons. (Closed)
Patch Set: Splitting off clearing Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_
6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ 6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // The |time| indicates the access time, and is used to detect when the 94 // The |time| indicates the access time, and is used to detect when the
95 // favicon should be refreshed. 95 // favicon should be refreshed.
96 // |pixel_size| is the pixel dimensions of |icon_data|. 96 // |pixel_size| is the pixel dimensions of |icon_data|.
97 // Returns the id of the added bitmap or 0 if unsuccessful. 97 // Returns the id of the added bitmap or 0 if unsuccessful.
98 FaviconBitmapID AddFaviconBitmap( 98 FaviconBitmapID AddFaviconBitmap(
99 favicon_base::FaviconID icon_id, 99 favicon_base::FaviconID icon_id,
100 const scoped_refptr<base::RefCountedMemory>& icon_data, 100 const scoped_refptr<base::RefCountedMemory>& icon_data,
101 base::Time time, 101 base::Time time,
102 const gfx::Size& pixel_size); 102 const gfx::Size& pixel_size);
103 103
104 // The same as AddFaviconBitmap(), it also marks the bitmap as "on-demand".
105 //
106 // On-demand bitmaps are those that are fetched without visiting their page.
107 // For this reason, their life-time cannot be bound to the life-time of the
108 // corresponding visit in history.
109 // - These bitmaps are evicted from the database based on the last time they
110 // get requested. The last requested time is initially set to |time| and is
111 // further updated by calling KeepOnDemandFavicon().
112 // - Furthermore, on-demand bitmaps are immediately marked as expired. Hence,
113 // they are always replaced by standard favicons whenever their page gets
114 // visited.
115 FaviconBitmapID AddOnDemandFaviconBitmap(
116 favicon_base::FaviconID icon_id,
117 const scoped_refptr<base::RefCountedMemory>& icon_data,
118 base::Time time,
119 const gfx::Size& pixel_size);
120
104 // Sets the bitmap data and the last updated time for the favicon bitmap at 121 // Sets the bitmap data and the last updated time for the favicon bitmap at
105 // |bitmap_id|. 122 // |bitmap_id|.
106 // Returns true if successful. 123 // Returns true if successful.
107 bool SetFaviconBitmap(FaviconBitmapID bitmap_id, 124 bool SetFaviconBitmap(FaviconBitmapID bitmap_id,
108 scoped_refptr<base::RefCountedMemory> bitmap_data, 125 scoped_refptr<base::RefCountedMemory> bitmap_data,
109 base::Time time); 126 base::Time time);
110 127
111 // Sets the last updated time for the favicon bitmap at |bitmap_id|. 128 // Sets the last updated time for the favicon bitmap at |bitmap_id|.
112 // Returns true if successful. 129 // Returns true if successful.
113 bool SetFaviconBitmapLastUpdateTime(FaviconBitmapID bitmap_id, 130 bool SetFaviconBitmapLastUpdateTime(FaviconBitmapID bitmap_id,
114 base::Time time); 131 base::Time time);
115 132
116 // Sets the last requested time for the favicon bitmap at |bitmap_id|.
117 // Returns true if successful.
118 bool SetFaviconBitmapLastRequestedTime(FaviconBitmapID bitmap_id,
119 base::Time time);
120
121 // Deletes the favicon bitmap with |bitmap_id|. 133 // Deletes the favicon bitmap with |bitmap_id|.
122 // Returns true if successful. 134 // Returns true if successful.
123 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); 135 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id);
124 136
125 // Favicons ------------------------------------------------------------------ 137 // Favicons ------------------------------------------------------------------
126 138
127 // Sets the the favicon as out of date. This will set |last_updated| for all 139 // Sets the the favicon as out of date. This will set |last_updated| for all
128 // of the bitmaps for |icon_id| to be out of date. 140 // of the bitmaps for |icon_id| to be out of date.
129 bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); 141 bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id);
130 142
143 // Mark all on-demand bitmaps at |icon_url| as requested at |time|. This
144 // postpones their automatic eviction from the database. Not all calls end up
145 // in a write into the DB:
146 // - it is no-op if the bitmaps are not stored using SetOnDemandFaviconBitmap;
147 // - the updates of the last requested time have limited frequency for each
148 // particular bitmap (e.g. once per week). This limits the overhead of
149 // cache management for on-demand favicons.
150 // Returns true if successful.
151 bool TouchOnDemandFavicon(const GURL& icon_url, base::Time time);
152
131 // Returns the id of the entry in the favicon database with the specified url 153 // Returns the id of the entry in the favicon database with the specified url
132 // and icon type. 154 // and icon type.
133 // Returns 0 if no entry exists for the specified url. 155 // Returns 0 if no entry exists for the specified url.
134 favicon_base::FaviconID GetFaviconIDForFaviconURL( 156 favicon_base::FaviconID GetFaviconIDForFaviconURL(
135 const GURL& icon_url, 157 const GURL& icon_url,
136 favicon_base::IconType icon_type); 158 favicon_base::IconType icon_type);
137 159
138 // Gets the icon_url, icon_type and sizes for the specified |icon_id|. 160 // Gets the icon_url, icon_type and sizes for the specified |icon_id|.
139 bool GetFaviconHeader(favicon_base::FaviconID icon_id, 161 bool GetFaviconHeader(favicon_base::FaviconID icon_id,
140 GURL* icon_url, 162 GURL* icon_url,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 285
264 sql::Connection db_; 286 sql::Connection db_;
265 sql::MetaTable meta_table_; 287 sql::MetaTable meta_table_;
266 288
267 HistoryBackendClient* backend_client_; 289 HistoryBackendClient* backend_client_;
268 }; 290 };
269 291
270 } // namespace history 292 } // namespace history
271 293
272 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ 294 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698