| Index: components/history/core/browser/expire_history_backend.cc
|
| diff --git a/components/history/core/browser/expire_history_backend.cc b/components/history/core/browser/expire_history_backend.cc
|
| index d57a60432afb85c3f74790c13d50d8e7865dd7b9..481af20408b231942de7fd6caec9dd6002063e6f 100644
|
| --- a/components/history/core/browser/expire_history_backend.cc
|
| +++ b/components/history/core/browser/expire_history_backend.cc
|
| @@ -12,6 +12,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/compiler_specific.h"
|
| +#include "base/feature_list.h"
|
| #include "base/files/file_enumerator.h"
|
| #include "base/files/file_util.h"
|
| #include "base/location.h"
|
| @@ -114,6 +115,10 @@ const int kExpirationDelaySec = 30;
|
| // iteration, so we want to wait longer before checking to avoid wasting CPU.
|
| const int kExpirationEmptyDelayMin = 5;
|
|
|
| +// Feature that enables clearing old on-demand favicons.
|
| +const base::Feature kClearOldOnDemandFavicons{
|
| + "ClearOldOnDemandFavicons", base::FEATURE_DISABLED_BY_DEFAULT};
|
| +
|
| } // namespace
|
|
|
|
|
| @@ -300,6 +305,19 @@ void ExpireHistoryBackend::StartExpiringOldStuff(
|
| // Initialize the queue with all tasks for the first set of iterations.
|
| InitWorkQueue();
|
| ScheduleExpire();
|
| +
|
| + // Remove favicons that are not bound to visits.
|
| + if (!base::FeatureList::IsEnabled(kClearOldOnDemandFavicons))
|
| + return;
|
| + task_runner_->PostDelayedTask(
|
| + FROM_HERE,
|
| + base::Bind(&ExpireHistoryBackend::ClearOldOnDemandFavicons,
|
| + weak_factory_.GetWeakPtr()),
|
| + base::TimeDelta::FromSeconds(kExpirationDelaySec));
|
| +}
|
| +
|
| +void ExpireHistoryBackend::ClearOldOnDemandFavicons() {
|
| + thumb_db_->ClearOldOnDemandFavicons(GetCurrentExpirationTime());
|
| }
|
|
|
| void ExpireHistoryBackend::DeleteFaviconsIfPossible(DeleteEffects* effects) {
|
|
|