| Index: chrome/browser/history/top_sites_cache.cc
|
| diff --git a/chrome/browser/history/top_sites_cache.cc b/chrome/browser/history/top_sites_cache.cc
|
| index 6552f73ac61858267a5a713a0273b79b13442980..284377ff01b9c520ea662533eb3947bd9ce50357 100644
|
| --- a/chrome/browser/history/top_sites_cache.cc
|
| +++ b/chrome/browser/history/top_sites_cache.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/memory/ref_counted_memory.h"
|
| +#include "url/gurl.h"
|
|
|
| namespace history {
|
|
|
| @@ -30,7 +31,7 @@ Images* TopSitesCache::GetImage(const GURL& url) {
|
|
|
| bool TopSitesCache::GetPageThumbnail(
|
| const GURL& url,
|
| - scoped_refptr<base::RefCountedMemory>* bytes) {
|
| + scoped_refptr<base::RefCountedMemory>* bytes) const {
|
| std::map<GURL, Images>::const_iterator found =
|
| images_.find(GetCanonicalURL(url));
|
| if (found != images_.end()) {
|
| @@ -44,7 +45,7 @@ bool TopSitesCache::GetPageThumbnail(
|
| }
|
|
|
| bool TopSitesCache::GetPageThumbnailScore(const GURL& url,
|
| - ThumbnailScore* score) {
|
| + ThumbnailScore* score) const {
|
| std::map<GURL, Images>::const_iterator found =
|
| images_.find(GetCanonicalURL(url));
|
| if (found != images_.end()) {
|
| @@ -54,21 +55,21 @@ bool TopSitesCache::GetPageThumbnailScore(const GURL& url,
|
| return false;
|
| }
|
|
|
| -const GURL& TopSitesCache::GetCanonicalURL(const GURL& url) {
|
| - CanonicalURLs::iterator i = GetCanonicalURLsIterator(url);
|
| - return i == canonical_urls_.end() ? url : i->first.first->url;
|
| +const GURL& TopSitesCache::GetCanonicalURL(const GURL& url) const {
|
| + CanonicalURLs::const_iterator it = GetCanonicalURLsIterator(url);
|
| + return it == canonical_urls_.end() ? url : it->first.first->url;
|
| }
|
|
|
| -const GURL& TopSitesCache::GetCanonicalURLForPrefix(const GURL& url) {
|
| - CanonicalURLs::iterator i = GetCanonicalURLsIteratorForPrefix(url);
|
| - return i == canonical_urls_.end() ? url : i->first.first->url;
|
| +const GURL& TopSitesCache::GetCanonicalURLForPrefix(const GURL& url) const {
|
| + CanonicalURLs::const_iterator it = GetCanonicalURLsIteratorForPrefix(url);
|
| + return it == canonical_urls_.end() ? url : it->first.first->url;
|
| }
|
|
|
| -bool TopSitesCache::IsKnownURL(const GURL& url) {
|
| +bool TopSitesCache::IsKnownURL(const GURL& url) const {
|
| return GetCanonicalURLsIterator(url) != canonical_urls_.end();
|
| }
|
|
|
| -size_t TopSitesCache::GetURLIndex(const GURL& url) {
|
| +size_t TopSitesCache::GetURLIndex(const GURL& url) const {
|
| DCHECK(IsKnownURL(url));
|
| return GetCanonicalURLsIterator(url)->second;
|
| }
|
| @@ -96,8 +97,8 @@ void TopSitesCache::StoreRedirectChain(const RedirectList& redirects,
|
| }
|
| }
|
|
|
| -TopSitesCache::CanonicalURLs::iterator TopSitesCache::GetCanonicalURLsIterator(
|
| - const GURL& url) {
|
| +TopSitesCache::CanonicalURLs::const_iterator
|
| + TopSitesCache::GetCanonicalURLsIterator(const GURL& url) const {
|
| MostVisitedURL most_visited_url;
|
| most_visited_url.redirects.push_back(url);
|
| CanonicalURLEntry entry;
|
| @@ -106,8 +107,9 @@ TopSitesCache::CanonicalURLs::iterator TopSitesCache::GetCanonicalURLsIterator(
|
| return canonical_urls_.find(entry);
|
| }
|
|
|
| -TopSitesCache::CanonicalURLs::iterator
|
| - TopSitesCache::GetCanonicalURLsIteratorForPrefix(const GURL& prefix_url) {
|
| +TopSitesCache::CanonicalURLs::const_iterator
|
| + TopSitesCache::GetCanonicalURLsIteratorForPrefix(const GURL& prefix_url)
|
| + const {
|
| MostVisitedURL most_visited_url;
|
| most_visited_url.redirects.push_back(prefix_url);
|
| CanonicalURLEntry entry;
|
| @@ -115,7 +117,7 @@ TopSitesCache::CanonicalURLs::iterator
|
| entry.second = 0u;
|
|
|
| // Perform effective binary search for URL prefix search.
|
| - TopSitesCache::CanonicalURLs::iterator it =
|
| + TopSitesCache::CanonicalURLs::const_iterator it =
|
| canonical_urls_.lower_bound(entry);
|
| // Perform prefix match.
|
| if (it != canonical_urls_.end()) {
|
|
|