Commit 6b09a3fa authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

history: minor cleanup and dead code removal

GetRedirectDistanceForURL() is no longer used.

BUG=none
TEST=none

Change-Id: Ia47669629a160dab79f6d872fd96c7d6e09baa59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761493
Auto-Submit: Scott Violet <sky@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688465}
parent acff9bd3
...@@ -42,7 +42,7 @@ class TopSitesCache { ...@@ -42,7 +42,7 @@ class TopSitesCache {
private: private:
// The entries in CanonicalURLs, see CanonicalURLs for details. The second // The entries in CanonicalURLs, see CanonicalURLs for details. The second
// argument gives the index of the URL into MostVisitedURLs redirects. // argument gives the index of the URL into MostVisitedURLs redirects.
typedef std::pair<MostVisitedURL*, size_t> CanonicalURLEntry; using CanonicalURLEntry = std::pair<MostVisitedURL*, size_t>;
// Comparator used for CanonicalURLs. // Comparator used for CanonicalURLs.
class CanonicalURLComparator { class CanonicalURLComparator {
...@@ -74,8 +74,8 @@ class TopSitesCache { ...@@ -74,8 +74,8 @@ class TopSitesCache {
// index of the redirect as the key, and the index into top_sites_ as the // index of the redirect as the key, and the index into top_sites_ as the
// value. This way we aren't duplicating GURLs. CanonicalURLComparator // value. This way we aren't duplicating GURLs. CanonicalURLComparator
// enforces the ordering as if we were using GURLs. // enforces the ordering as if we were using GURLs.
typedef std::map<CanonicalURLEntry, size_t, using CanonicalURLs =
CanonicalURLComparator> CanonicalURLs; std::map<CanonicalURLEntry, size_t, CanonicalURLComparator>;
// Generates the set of canonical urls from |top_sites_|. // Generates the set of canonical urls from |top_sites_|.
void GenerateCanonicalURLs(); void GenerateCanonicalURLs();
...@@ -93,7 +93,7 @@ class TopSitesCache { ...@@ -93,7 +93,7 @@ class TopSitesCache {
MostVisitedURLList top_sites_; MostVisitedURLList top_sites_;
// Generated from the redirects to and from the most visited pages. See // Generated from the redirects to and from the most visited pages. See
// description above typedef for details. // description above CanonicalURLs for details.
CanonicalURLs canonical_urls_; CanonicalURLs canonical_urls_;
DISALLOW_COPY_AND_ASSIGN(TopSitesCache); DISALLOW_COPY_AND_ASSIGN(TopSitesCache);
......
...@@ -302,17 +302,6 @@ void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, ...@@ -302,17 +302,6 @@ void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list,
} }
} }
// static
int TopSitesImpl::GetRedirectDistanceForURL(const MostVisitedURL& most_visited,
const GURL& url) {
for (size_t i = 0; i < most_visited.redirects.size(); i++) {
if (most_visited.redirects[i] == url)
return static_cast<int>(most_visited.redirects.size() - i - 1);
}
NOTREACHED() << "URL should always be found.";
return 0;
}
bool TopSitesImpl::AddPrepopulatedPages(MostVisitedURLList* urls) const { bool TopSitesImpl::AddPrepopulatedPages(MostVisitedURLList* urls) const {
bool added = false; bool added = false;
for (const auto& prepopulated_page : prepopulated_pages_) { for (const auto& prepopulated_page : prepopulated_pages_) {
......
...@@ -127,12 +127,6 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver { ...@@ -127,12 +127,6 @@ class TopSitesImpl : public TopSites, public HistoryServiceObserver {
const MostVisitedURLList& new_list, const MostVisitedURLList& new_list,
TopSitesDelta* delta); TopSitesDelta* delta);
// Finds the given URL in the redirect chain for the given TopSite, and
// returns the distance from the destination in hops that the given URL is.
// The URL is assumed to be in the list. The destination is 0.
static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited,
const GURL& url);
// Adds prepopulated pages to TopSites. Returns true if any pages were added. // Adds prepopulated pages to TopSites. Returns true if any pages were added.
bool AddPrepopulatedPages(MostVisitedURLList* urls) const; bool AddPrepopulatedPages(MostVisitedURLList* urls) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment