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

Unified Diff: chrome/browser/history/top_sites_database.cc

Issue 2948008: Fix missing thumbnails for new profile with TopSites. (Closed)
Patch Set: After second review. Created 10 years, 5 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
« no previous file with comments | « chrome/browser/history/top_sites.cc ('k') | chrome/browser/history/top_sites_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites_database.cc
diff --git a/chrome/browser/history/top_sites_database.cc b/chrome/browser/history/top_sites_database.cc
index d563fa3a0edd526dfd2597269ba03aec06f8632a..99f0bb44ec277662bed13040ccc4ad6eb52071f7 100644
--- a/chrome/browser/history/top_sites_database.cc
+++ b/chrome/browser/history/top_sites_database.cc
@@ -194,7 +194,7 @@ void TopSitesDatabaseImpl::UpdatePageRankNoTransaction(
const MostVisitedURL& url, int new_rank) {
int prev_rank = GetURLRank(url);
if (prev_rank == -1) {
- NOTREACHED() << "Updating rank of an unknown URL.";
+ NOTREACHED() << "Updating rank of an unknown URL: " << url.url.spec();
return;
}
@@ -263,7 +263,7 @@ bool TopSitesDatabaseImpl::GetPageThumbnail(const GURL& url,
}
int TopSitesDatabaseImpl::GetRowCount() {
- int result = -1;
+ int result = 0;
sql::Statement select_statement(db_.GetCachedStatement(
SQL_FROM_HERE,
"SELECT COUNT (url) FROM thumbnails"));
@@ -299,6 +299,9 @@ int TopSitesDatabaseImpl::GetURLRank(const MostVisitedURL& url) {
// Remove the record for this URL. Returns true iff removed successfully.
bool TopSitesDatabaseImpl::RemoveURL(const MostVisitedURL& url) {
int old_rank = GetURLRank(url);
+ if (old_rank < 0)
+ return false;
+
sql::Transaction transaction(&db_);
transaction.Begin();
// Decrement all following ranks.
« no previous file with comments | « chrome/browser/history/top_sites.cc ('k') | chrome/browser/history/top_sites_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698