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

Unified Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 2162533002: Adding a request counter to the snippets fetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@traffic-monitor
Patch Set: Rebase + rename to throttler Created 4 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/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 736eb4933f9bc285284c17d78067728ba0b39da9..54091d5834f4c9005c963fef12cf6ecc513db970 100644
--- a/components/ntp_snippets/ntp_snippets_service.cc
+++ b/components/ntp_snippets/ntp_snippets_service.cc
@@ -247,19 +247,20 @@ void NTPSnippetsService::Shutdown() {
EnterState(State::SHUT_DOWN, ContentSuggestionsCategoryStatus::NOT_PROVIDED);
}
-void NTPSnippetsService::FetchSnippets() {
+void NTPSnippetsService::FetchSnippets(bool force_request) {
if (ready())
- FetchSnippetsFromHosts(GetSuggestionsHosts());
+ FetchSnippetsFromHosts(GetSuggestionsHosts(), force_request);
else
fetch_after_load_ = true;
}
void NTPSnippetsService::FetchSnippetsFromHosts(
- const std::set<std::string>& hosts) {
+ const std::set<std::string>& hosts,
+ bool force_request) {
if (!ready())
return;
snippets_fetcher_->FetchSnippetsFromHosts(hosts, application_language_code_,
- kMaxSnippetCount);
+ kMaxSnippetCount, force_request);
}
void NTPSnippetsService::RescheduleFetching() {
@@ -439,7 +440,7 @@ void NTPSnippetsService::OnSuggestionsChanged(
NotifyNewSuggestions();
- FetchSnippetsFromHosts(hosts);
+ FetchSnippetsFromHosts(hosts, false);
Marc Treib 2016/07/22 13:52:52 /* force_request */ ?
jkrcal 2016/07/25 10:05:38 Done.
}
void NTPSnippetsService::OnFetchFinished(
@@ -652,7 +653,7 @@ void NTPSnippetsService::FetchSnippetImageFromNetwork(
void NTPSnippetsService::EnterStateEnabled(bool fetch_snippets) {
if (fetch_snippets)
- FetchSnippets();
+ FetchSnippets(false);
Marc Treib 2016/07/22 13:52:52 here too
jkrcal 2016/07/25 10:05:38 Done.
// If host restrictions are enabled, register for host list updates.
// |suggestions_service_| can be null in tests.

Powered by Google App Engine
This is Rietveld 408576698