| Index: components/ntp_snippets/ntp_snippets_service.cc
|
| diff --git a/components/ntp_snippets/ntp_snippets_service.cc b/components/ntp_snippets/ntp_snippets_service.cc
|
| index 96abae0e29d6dfe3fd741884712be99f1719456d..5eddd097b2b5b1d356165e4d25e213276f930d92 100644
|
| --- a/components/ntp_snippets/ntp_snippets_service.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_service.cc
|
| @@ -348,6 +348,8 @@ void NTPSnippetsService::OnSnippetsDownloaded(
|
| if (!snippets_json.empty()) {
|
| DCHECK(status.empty());
|
|
|
| + last_fetch_json_ = snippets_json;
|
| +
|
| parse_json_callback_.Run(
|
| snippets_json,
|
| base::Bind(&NTPSnippetsService::OnJsonParsed,
|
| @@ -423,11 +425,6 @@ bool NTPSnippetsService::LoadFromListValue(const base::ListValue& list) {
|
| std::make_move_iterator(new_snippets.begin()),
|
| std::make_move_iterator(new_snippets.end()));
|
|
|
| - // If there are more snippets now than we want to show, drop the extra ones
|
| - // from the end of the list.
|
| - if (snippets_.size() > kMaxSnippetCount)
|
| - snippets_.resize(kMaxSnippetCount);
|
| -
|
| return true;
|
| }
|
|
|
| @@ -485,6 +482,12 @@ void NTPSnippetsService::LoadingSnippetsFinished() {
|
| return snippet->expiry_date() <= expiry;
|
| }),
|
| snippets_.end());
|
| +
|
| + // If there are more snippets now than we want to show, drop the extra ones
|
| + // from the end of the list.
|
| + if (snippets_.size() > kMaxSnippetCount)
|
| + snippets_.resize(kMaxSnippetCount);
|
| +
|
| StoreSnippetsToPrefs();
|
|
|
| discarded_snippets_.erase(
|
|
|