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

Unified Diff: components/history/core/browser/top_sites_impl.h

Issue 2881753002: TopSites: various small cleanups (Closed)
Patch Set: Created 3 years, 7 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
Index: components/history/core/browser/top_sites_impl.h
diff --git a/components/history/core/browser/top_sites_impl.h b/components/history/core/browser/top_sites_impl.h
index c83cb0a883a3ed75a6de3615bb0d6a1905c9bc9e..3024d448a4c9b5ea891658631897f274dc8d344f 100644
--- a/components/history/core/browser/top_sites_impl.h
+++ b/components/history/core/browser/top_sites_impl.h
@@ -23,10 +23,8 @@
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
-#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_service_observer.h"
#include "components/history/core/browser/history_types.h"
-#include "components/history/core/browser/page_usage_data.h"
#include "components/history/core/browser/top_sites.h"
#include "components/history/core/browser/top_sites_backend.h"
#include "components/history/core/common/thumbnail_score.h"
@@ -148,8 +146,7 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
const MostVisitedURLList& new_list,
TopSitesDelta* delta);
- // Sets the thumbnail without writing to the database. Useful when
- // reading last known top sites from the DB.
+ // Sets the thumbnail without writing to the database.
// Returns true if the thumbnail was set, false if the existing one is better.
bool SetPageThumbnailNoDB(const GURL& url,
const base::RefCountedMemory* thumbnail_data,
@@ -166,13 +163,13 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
static bool EncodeBitmap(const gfx::Image& bitmap,
scoped_refptr<base::RefCountedBytes>* bytes);
- // Removes the cached thumbnail for url. Does nothing if |url| if not cached
+ // Removes the cached thumbnail for |url|. Does nothing if |url| is not cached
// in |temp_images_|.
void RemoveTemporaryThumbnailByURL(const GURL& url);
- // Add a thumbnail for an unknown url. See temp_thumbnails_map_.
+ // Add a thumbnail for an unknown url. See |temp_images_|.
void AddTemporaryThumbnail(const GURL& url,
- const base::RefCountedMemory* thumbnail,
+ base::RefCountedMemory* thumbnail,
const ThumbnailScore& score);
// Called by our timer. Starts the query for the most visited sites.
@@ -187,7 +184,7 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
// Add prepopulated pages: 'welcome to Chrome' and themes gallery to |urls|.
// Returns true if any pages were added.
bool AddPrepopulatedPages(MostVisitedURLList* urls,
- size_t num_forced_urls);
+ size_t num_forced_urls) const;
// Add all the forced URLs from |cache_| into |new_list|, making sure not to
// add any URL that's already in |new_list|'s non-forced URLs. The forced URLs
@@ -195,7 +192,7 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
// and be sorted in increasing |last_forced_time|. This will still be true
// after the call. If the list of forced URLs overflows the older ones are
// dropped. Returns the number of forced URLs after the merge.
- size_t MergeCachedForcedURLs(MostVisitedURLList* new_list);
+ size_t MergeCachedForcedURLs(MostVisitedURLList* new_list) const;
// Takes |urls|, produces it's copy in |out| after removing blacklisted URLs.
// Also ensures we respect the maximum number of forced URLs and non-forced
@@ -203,11 +200,11 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
void ApplyBlacklist(const MostVisitedURLList& urls, MostVisitedURLList* out);
// Returns an MD5 hash of the URL. Hashing is required for blacklisted URLs.
- std::string GetURLHash(const GURL& url);
+ static std::string GetURLHash(const GURL& url);
// Returns the delay until the next update of history is needed.
- // Uses num_urls_changed
- base::TimeDelta GetUpdateDelay();
+ // Uses |last_num_urls_changed_|.
+ base::TimeDelta GetUpdateDelay() const;
// Updates URLs in |cache_| and the db (in the background).
// The non-forced URLs in |new_top_sites| replace those in |cache_|.
@@ -258,8 +255,8 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
std::unique_ptr<TopSitesCache> cache_;
// Copy of the top sites data that may be accessed on any thread (assuming
- // you hold |lock_|). The data in |thread_safe_cache_| has blacklisted and
- // pinned urls applied (|cache_| does not).
+ // you hold |lock_|). The data in |thread_safe_cache_| has blacklisted urls
+ // applied (|cache_| does not).
std::unique_ptr<TopSitesCache> thread_safe_cache_;
// Lock used to access |thread_safe_cache_|.
@@ -286,11 +283,11 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
// Stores thumbnails for unknown pages. When SetPageThumbnail is
// called, if we don't know about that URL yet and we don't have
// enough Top Sites (new profile), we store it until the next
- // SetNonForcedTopSites call.
+ // SetTopSites call.
TempImages temp_images_;
// URL List of prepopulated page.
- PrepopulatedPageList prepopulated_pages_;
+ const PrepopulatedPageList prepopulated_pages_;
// PrefService holding the NTP URL blacklist dictionary. Must outlive
// TopSitesImpl.
« no previous file with comments | « components/history/core/browser/top_sites_cache.h ('k') | components/history/core/browser/top_sites_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698