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

Unified Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2557363002: [NTP Snippets] Refactor background scheduling for remote suggestions (Closed)
Patch Set: Tim's comments and splitting RemoteSuggestionsProvider and RemoteSuggestionsProviderImpl Created 4 years 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/content_suggestions_service.cc
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc
index 5cd19fd2c70fd03eee9b33759ee80ec3a1c7c29f..b6f64376e6cd95a87c3f59d532af48559964b254 100644
--- a/components/ntp_snippets/content_suggestions_service.cc
+++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -29,7 +29,8 @@ ContentSuggestionsService::ContentSuggestionsService(
: state_(state),
signin_observer_(this),
history_service_observer_(this),
- ntp_snippets_service_(nullptr),
+ remote_suggestions_provider_(nullptr),
+ remote_suggestions_scheduler_(nullptr),
tschumann 2016/12/19 11:07:19 why do we need both? Shouldn't the SchedulingRemo
Marc Treib 2016/12/19 12:59:23 But then that'd have to expose both members. And s
tschumann 2016/12/19 14:17:08 hehe... so my question is more: why do we still ne
jkrcal 2016/12/20 16:39:46 Thanks, agreed :)
jkrcal 2016/12/20 16:39:46 These are different interfaces, one is used for de
jkrcal 2016/12/20 16:39:46 As I say above, the only reason for the moment is
tschumann 2016/12/21 08:21:18 Oh yeah, totally. The scheduling remote suggestion
jkrcal 2016/12/21 08:40:49 Done, in the end. Scheduling... now implements Rem
pref_service_(pref_service),
user_classifier_(pref_service) {
// Can be null in tests.
@@ -47,7 +48,8 @@ ContentSuggestionsService::ContentSuggestionsService(
ContentSuggestionsService::~ContentSuggestionsService() = default;
void ContentSuggestionsService::Shutdown() {
- ntp_snippets_service_ = nullptr;
+ remote_suggestions_provider_ = nullptr;
+ remote_suggestions_scheduler_ = nullptr;
suggestions_by_category_.clear();
providers_by_category_.clear();
categories_.clear();
@@ -223,6 +225,12 @@ void ContentSuggestionsService::Fetch(
providers_it->second->Fetch(category, known_suggestion_ids, callback);
}
+void ContentSuggestionsService::ReloadSuggestions() {
+ for (const auto& category_provider_pair : providers_by_category_) {
+ category_provider_pair.second->ReloadSuggestions();
Marc Treib 2016/12/19 12:59:23 If a provider provides multiple categories, then i
jkrcal 2016/12/20 16:39:46 Indeed, thanks! I do not see how to implement ski
tschumann 2016/12/21 08:21:18 +1 for such providers that would be a no-op anyway
jkrcal 2016/12/21 08:40:49 Acknowledged.
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// Private methods

Powered by Google App Engine
This is Rietveld 408576698