Chromium Code Reviews| Index: components/doodle/doodle_service.cc |
| diff --git a/components/doodle/doodle_service.cc b/components/doodle/doodle_service.cc |
| index cd4b053edf1c7083b14f13e6c7f8db6e290bd971..882c2f71cdffc00785893fbe1af529a5c6949832 100644 |
| --- a/components/doodle/doodle_service.cc |
| +++ b/components/doodle/doodle_service.cc |
| @@ -87,6 +87,9 @@ void DoodleService::Refresh() { |
| if (time_since_fetch < min_refresh_interval_) { |
| RecordDownloadMetrics(OUTCOME_REFRESH_INTERVAL_NOT_PASSED, |
| base::TimeDelta()); |
| + for (auto& observer : observers_) { |
| + observer.OnDoodleConfigRevalidated(/*from_cache=*/true); |
| + } |
| return; |
| } |
| fetcher_->FetchDoodle(base::BindOnce(&DoodleService::DoodleFetched, |
| @@ -192,7 +195,6 @@ DoodleService::DownloadOutcome DoodleService::HandleNewConfig( |
| DownloadOutcome outcome = |
| DetermineDownloadOutcome(cached_config_, new_config, state, expired); |
| - // If the config changed, update our cache and notify observers. |
| // Note that this checks both for existence changes as well as changes of the |
| // configs themselves. |
| if (cached_config_ != new_config) { |
| @@ -201,6 +203,10 @@ DoodleService::DownloadOutcome DoodleService::HandleNewConfig( |
| for (auto& observer : observers_) { |
| observer.OnDoodleConfigUpdated(cached_config_); |
| } |
| + } else if (!expired) { |
|
Marc Treib
2017/04/27 15:22:55
Why the "if (!expired)"? This seems like an edge c
fhorschig
2017/04/28 08:20:07
Gone.
We previously checked in the test Disregards
|
| + for (auto& observer : observers_) { |
| + observer.OnDoodleConfigRevalidated(/*from_cache=*/false); |
| + } |
| } |
| // Even if the configs are identical, the time-to-live might have changed. |