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

Side by Side Diff: components/ntp_snippets/remote/remote_suggestions_hard_scheduler.h

Issue 2557363002: [NTP Snippets] Refactor background scheduling for remote suggestions (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_HARD_SCHEDULER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_HARD_SCHEDULER_H_
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_HARD_SCHEDULER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_HARD_SCHEDULER_H_
Marc Treib 2016/12/08 16:14:58 The diff is weird (missing) here... do you maybe h
jkrcal 2016/12/09 09:20:37 Oh, shit. I've messed up :) The two files you've s
Marc Treib 2016/12/09 10:55:37 Well, I guess the only way would be to land anothe
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 10
11 namespace ntp_snippets { 11 namespace ntp_snippets {
12 12
13 // Interface to schedule "hard" periodic fetches of snippets. These "hard" 13 // Interface to schedule "hard" periodic fetches of snippets. These "hard"
14 // fetches must get triggered according to their schedule independent of whether 14 // fetches must get triggered according to their schedule independent of whether
15 // Chrome is running at that moment. 15 // Chrome is running at that moment.
16 class RemoteSuggestionsHardScheduler { 16 class RemoteSuggestionsHardScheduler {
17 public: 17 public:
18 // Schedule periodic fetching of snippets, with different periods depending on 18 // Schedule periodic fetching of snippets, with different periods depending on
19 // network state. Once per period, the concrete implementation should call 19 // network state. Once per period, the concrete implementation should call
20 // RemoteSuggestionsScheduler::Updater::HardUpdate() where the updater is 20 // RemoteSuggestionsScheduler::Updater::HardUpdate() where the updater is
21 // obtained from ContentSuggestionsService. Any of the periods can be zero to 21 // obtained from ContentSuggestionsService. Any of the periods can be zero to
22 // indicate that the corresponding task should not be scheduled. 22 // indicate that the corresponding task should not be scheduled.
23 virtual bool Schedule(base::TimeDelta period_wifi, 23 virtual bool Schedule(base::TimeDelta period_wifi,
24 base::TimeDelta period_fallback) = 0; 24 base::TimeDelta period_fallback) = 0;
25 25
26 // Cancel any scheduled tasks. 26 // Cancel any scheduled tasks. Equivalent to Schedule(0, 0).
27 virtual bool Unschedule() = 0; 27 virtual bool Unschedule() = 0;
28 28
29 protected: 29 protected:
30 RemoteSuggestionsHardScheduler() = default; 30 RemoteSuggestionsHardScheduler() = default;
31 31
32 private: 32 private:
33 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsHardScheduler); 33 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsHardScheduler);
34 }; 34 };
35 35
36 } // namespace ntp_snippets 36 } // namespace ntp_snippets
37 37
38 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_HARD_SCHEDULER_H_ 38 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_HARD_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698