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

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

Issue 2386103009: NTPSnippetsService: Garbage collect orphaned images at startup. (Closed)
Patch Set: patch restored 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 do not have any corresponding snippet in
239 // (neither in the current set, nor in the archived set). 239 // the provided set. Needs to iterate the whole snippet database -- so do it
240 void ClearOrphanedImages(); 240 // often enough to keep it small but not too often as it still iterates over
241 // the file system.
242 void ClearOrphanedImages(const NTPSnippet::PtrVector& snippets);
241 243
242 // Clears all stored snippets and updates the observer. 244 // Clears all stored snippets and updates the observer.
243 void NukeAllSnippets(); 245 void NukeAllSnippets();
244 246
245 // Completes the initialization phase of the service, registering the last 247 // Completes the initialization phase of the service, registering the last
246 // observers. This is done after construction, once the database is loaded. 248 // observers. This is done after construction, once the database is loaded.
247 void FinishInitialization(); 249 void FinishInitialization();
248 250
249 void OnSnippetImageFetchedFromDatabase( 251 void OnSnippetImageFetchedFromDatabase(
250 const ImageFetchedCallback& callback, 252 const ImageFetchedCallback& callback,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 378
377 // Request throttler for limiting requests to thumbnail images. 379 // Request throttler for limiting requests to thumbnail images.
378 RequestThrottler thumbnail_requests_throttler_; 380 RequestThrottler thumbnail_requests_throttler_;
379 381
380 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); 382 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService);
381 }; 383 };
382 384
383 } // namespace ntp_snippets 385 } // namespace ntp_snippets
384 386
385 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ 387 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698