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

Unified Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1863213004: [NTP Snippets] Cleanup: remove NTPSnippetsService::is_loaded() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove now-pointless tests Created 4 years, 8 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
« no previous file with comments | « chrome/browser/android/ntp/ntp_snippets_bridge.cc ('k') | components/ntp_snippets/ntp_snippets_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_service.h
diff --git a/components/ntp_snippets/ntp_snippets_service.h b/components/ntp_snippets/ntp_snippets_service.h
index ff2b039c00bb6771a4bb3bfab7e67d953349d1ba..ea0aabab27cd05e6f1edf4e07f41382d869b9351 100644
--- a/components/ntp_snippets/ntp_snippets_service.h
+++ b/components/ntp_snippets/ntp_snippets_service.h
@@ -72,9 +72,6 @@ class NTPSnippetsService : public KeyedService {
// Inherited from KeyedService.
void Shutdown() override;
- // True once the data is loaded in memory and available to loop over.
- bool is_loaded() { return loaded_; }
-
// Fetches snippets from the server and adds them to the current ones.
void FetchSnippets();
@@ -86,11 +83,8 @@ class NTPSnippetsService : public KeyedService {
void AddObserver(NTPSnippetsServiceObserver* observer);
void RemoveObserver(NTPSnippetsServiceObserver* observer);
- // Number of snippets available. Can only be called when is_loaded() is true.
- size_t size() const {
- DCHECK(loaded_);
- return snippets_.size();
- }
+ // Number of snippets available.
+ size_t size() const { return snippets_.size(); }
// The snippets can be iterated upon only via a const_iterator. Recommended
// way to iterate is as follows:
@@ -99,14 +93,8 @@ class NTPSnippetsService : public KeyedService {
// for (auto& snippet : *service) {
// // |snippet| here is a const object.
// }
- const_iterator begin() const {
- DCHECK(loaded_);
- return const_iterator(snippets_.begin());
- }
- const_iterator end() const {
- DCHECK(loaded_);
- return const_iterator(snippets_.end());
- }
+ const_iterator begin() const { return const_iterator(snippets_.begin()); }
+ const_iterator end() const { return const_iterator(snippets_.end()); }
private:
friend class NTPSnippetsServiceTest;
@@ -144,9 +132,6 @@ class NTPSnippetsService : public KeyedService {
suggestions::SuggestionsService* suggestions_service_;
- // True if the suggestions are loaded.
- bool loaded_;
-
// The SequencedTaskRunner on which file system operations will be run.
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
@@ -192,9 +177,9 @@ class NTPSnippetsService : public KeyedService {
class NTPSnippetsServiceObserver {
public:
- // Send everytime the service loads a new set of data.
+ // Sent every time the service loads a new set of data.
virtual void NTPSnippetsServiceLoaded(NTPSnippetsService* service) = 0;
- // Send when the service is shutting down.
+ // Sent when the service is shutting down.
virtual void NTPSnippetsServiceShutdown(NTPSnippetsService* service) = 0;
protected:
« no previous file with comments | « chrome/browser/android/ntp/ntp_snippets_bridge.cc ('k') | components/ntp_snippets/ntp_snippets_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698