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

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

Issue 2499003: Write thumbnail to the database on SetPageThumbnail.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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
« 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
===================================================================
--- chrome/browser/history/top_sites_database.cc (revision 48639)
+++ chrome/browser/history/top_sites_database.cc (working copy)
@@ -34,7 +34,11 @@
"url_rank INTEGER ,"
"title LONGVARCHAR,"
"thumbnail BLOB,"
- "redirects LONGVARCHAR)")) {
+ "redirects LONGVARCHAR,"
+ "boring_score DOUBLE DEFAULT 1.0, "
+ "good_clipping INTEGER DEFAULT 0, "
+ "at_top INTEGER DEFAULT 0, "
+ "last_updated INTEGER DEFAULT 0) ")) {
LOG(WARNING) << db_.GetErrorMessage();
return false;
}
@@ -101,8 +105,9 @@
sql::Statement statement(db_.GetCachedStatement(
SQL_FROM_HERE,
"INSERT OR REPLACE INTO thumbnails "
- "(url, url_rank, title, thumbnail, redirects) "
- "VALUES (?, ?, ?, ?, ?)")); // TODO(Nik): add the rest of the schema.
+ "(url, url_rank, title, thumbnail, redirects, "
+ "boring_score, good_clipping, at_top, last_updated) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"));
if (!statement)
return;
@@ -114,6 +119,11 @@
static_cast<int>(thumbnail.thumbnail->data.size()));
}
statement.BindString(4, GetRedirects(url));
+ const ThumbnailScore& score = thumbnail.thumbnail_score;
+ statement.BindDouble(5, score.boring_score);
+ statement.BindBool(6, score.good_clipping);
+ statement.BindBool(7, score.at_top);
+ statement.BindInt64(8, score.time_at_snapshot.ToInternalValue());
if (!statement.Run())
NOTREACHED() << db_.GetErrorMessage();
@@ -166,23 +176,28 @@
bool TopSitesDatabaseImpl::GetPageThumbnail(const MostVisitedURL& url,
TopSites::Images* thumbnail) {
- sql::Statement select_statement(db_.GetCachedStatement(
+ sql::Statement statement(db_.GetCachedStatement(
SQL_FROM_HERE,
- "SELECT thumbnail "
+ "SELECT thumbnail, boring_score, good_clipping, at_top, last_updated "
"FROM thumbnails WHERE url=?"));
- if (!select_statement) {
+ if (!statement) {
LOG(WARNING) << db_.GetErrorMessage();
return false;
}
- select_statement.BindString(0, url.url.spec());
- if (!select_statement.Step())
+ statement.BindString(0, url.url.spec());
+ if (!statement.Step())
return false;
std::vector<unsigned char> data;
- select_statement.ColumnBlobAsVector(0, &data);
+ statement.ColumnBlobAsVector(0, &data);
thumbnail->thumbnail = RefCountedBytes::TakeVector(&data);
+ thumbnail->thumbnail_score.boring_score = statement.ColumnDouble(1);
+ thumbnail->thumbnail_score.good_clipping = statement.ColumnBool(2);
+ thumbnail->thumbnail_score.at_top = statement.ColumnBool(3);
+ thumbnail->thumbnail_score.time_at_snapshot =
+ base::Time::FromInternalValue(statement.ColumnInt64(4));
return true;
}
@@ -232,4 +247,3 @@
}
} // namespace history
-
« 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