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

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

Issue 2903573002: [Thumbnails DB] Add functionality to clear unused on-demand favicons. (Closed)
Patch Set: Peter's comments #3 Created 3 years, 5 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/expire_history_backend.h
diff --git a/components/history/core/browser/expire_history_backend.h b/components/history/core/browser/expire_history_backend.h
index ebffc5b62e4e14ee9b45b271c18c0a4f1333b326..83633eaae8ccbedc58dc6f29580a98ea726c26c3 100644
--- a/components/history/core/browser/expire_history_backend.h
+++ b/components/history/core/browser/expire_history_backend.h
@@ -20,6 +20,7 @@ class GURL;
class TestingProfile;
namespace base {
+struct Feature;
class SequencedTaskRunner;
}
@@ -42,6 +43,11 @@ class ExpiringVisitsReader {
typedef std::vector<const ExpiringVisitsReader*> ExpiringVisitsReaders;
+namespace internal {
+// Feature that enables clearing old on-demand favicons.
+extern const base::Feature kClearOldOnDemandFavicons;
+} // namespace internal
+
// Helper component to HistoryBackend that manages expiration and deleting of
// history.
//
@@ -102,6 +108,10 @@ class ExpireHistoryBackend {
FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpireSomeOldHistory);
FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpiringVisitsReader);
FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpireSomeOldHistoryWithSource);
+ FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest,
+ ClearOldOnDemandFaviconsDoesNotDeleteStarred);
+ FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest,
+ ClearOldOnDemandFaviconsDoesDeleteUnstarred);
friend class ::TestingProfile;
struct DeleteEffects {
@@ -179,6 +189,9 @@ class ExpireHistoryBackend {
// any now-unused favicons.
void ExpireURLsForVisits(const VisitVector& visits, DeleteEffects* effects);
+ // Clears all old on-demand favicons from thumbnail database.
+ void ClearOldOnDemandFavicons(base::Time expiration_threshold);
pkotwicz 2017/07/07 00:42:38 Nit: Match the function order in the .cc and the .
jkrcal 2017/07/07 08:45:16 Done.
+
// Deletes the favicons listed in |effects->affected_favicons| if they are
// unsued. Fails silently (we don't care about favicons so much, so don't want
// to stop everything if it fails). Fills |expired_favicons| with the set of

Powered by Google App Engine
This is Rietveld 408576698