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

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

Issue 2386103009: NTPSnippetsService: Garbage collect orphaned images at startup. (Closed)
Patch Set: final comments Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_NTP_SNIPPETS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 // Replace old snippets in |category| by newly available snippets. 229 // Replace old snippets in |category| by newly available snippets.
230 void ReplaceSnippets(Category category, NTPSnippet::PtrVector new_snippets); 230 void ReplaceSnippets(Category category, NTPSnippet::PtrVector new_snippets);
231 231
232 std::set<std::string> GetSnippetHostsFromPrefs() const; 232 std::set<std::string> GetSnippetHostsFromPrefs() const;
233 void StoreSnippetHostsToPrefs(const std::set<std::string>& hosts); 233 void StoreSnippetHostsToPrefs(const std::set<std::string>& hosts);
234 234
235 // Removes expired dismissed snippets from the service and the database. 235 // Removes expired dismissed snippets from the service and the database.
236 void ClearExpiredDismissedSnippets(); 236 void ClearExpiredDismissedSnippets();
237 237
238 // Removes images from the DB that do not have any corresponding snippet 238 // Removes images from the DB that are not referenced from any known snippet.
239 // (neither in the current set, nor in the archived set). 239 // Needs to iterate the whole snippet database -- so do it often enough to
240 // keep it small but not too often as it still iterates over the file system.
240 void ClearOrphanedImages(); 241 void ClearOrphanedImages();
241 242
242 // Clears all stored snippets and updates the observer. 243 // Clears all stored snippets and updates the observer.
243 void NukeAllSnippets(); 244 void NukeAllSnippets();
244 245
245 // Completes the initialization phase of the service, registering the last 246 // Completes the initialization phase of the service, registering the last
246 // observers. This is done after construction, once the database is loaded. 247 // observers. This is done after construction, once the database is loaded.
247 void FinishInitialization(); 248 void FinishInitialization();
248 249
249 void OnSnippetImageFetchedFromDatabase( 250 void OnSnippetImageFetchedFromDatabase(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 377
377 // Request throttler for limiting requests to thumbnail images. 378 // Request throttler for limiting requests to thumbnail images.
378 RequestThrottler thumbnail_requests_throttler_; 379 RequestThrottler thumbnail_requests_throttler_;
379 380
380 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); 381 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService);
381 }; 382 };
382 383
383 } // namespace ntp_snippets 384 } // namespace ntp_snippets
384 385
385 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ 386 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698