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

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

Issue 10815068: Changes favicon database to support storing bitmaps of different sizes for the same icon_url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as per Sky's suggestions on Aug 1 Created 8 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
Index: chrome/browser/history/history_backend.cc
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 7488b353720ba31d2142d85fb21626aec5dbb3e5..1d96ab67882bb2f71a49b10bd2c51306ba198967 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1795,7 +1795,7 @@ void HistoryBackend::SetFaviconOutOfDateForPage(const GURL& page_url) {
for (std::vector<IconMapping>::iterator m = icon_mappings.begin();
m != icon_mappings.end(); ++m) {
- thumbnail_db_->SetFaviconLastUpdateTime(m->icon_id, Time());
+ thumbnail_db_->SetFaviconOutOfDate(m->icon_id);
}
ScheduleCommit();
}
@@ -1832,7 +1832,7 @@ void HistoryBackend::SetImportedFavicons(
history::FAVICON);
if (!favicon_id)
continue; // Unable to add the favicon.
- thumbnail_db_->SetFavicon(favicon_id,
+ thumbnail_db_->AddFaviconFrame(favicon_id,
new base::RefCountedBytes(favicon_usage[i].png_data), now);
}
@@ -1955,7 +1955,7 @@ void HistoryBackend::SetFavicon(
id = thumbnail_db_->AddFavicon(icon_url, icon_type);
// Set the image data.
- thumbnail_db_->SetFavicon(id, data, Time::Now());
+ thumbnail_db_->AddFaviconFrame(id, data, Time::Now());
SetFaviconMapping(page_url, id, icon_type);
}
@@ -2334,8 +2334,11 @@ bool HistoryBackend::ClearAllThumbnailHistory(URLRows* kept_urls) {
return true;
}
- // Create the duplicate favicon table, this is where the favicons we want
- // to keep will be stored.
+ // Create duplicate favicon and favicon frames tables, this is where the
+ // favicons we want to keep will be stored.
+ if (!thumbnail_db_->InitTemporaryFaviconFramesTable())
sky 2012/08/02 19:50:31 I think it less error prone and easier to maintain
+ return false;
+
if (!thumbnail_db_->InitTemporaryFaviconsTable())
return false;
@@ -2360,6 +2363,7 @@ bool HistoryBackend::ClearAllThumbnailHistory(URLRows* kept_urls) {
FaviconMap::const_iterator found = copied_favicons.find(old_id);
if (found == copied_favicons.end()) {
new_id = thumbnail_db_->CopyToTemporaryFaviconTable(old_id);
+ thumbnail_db_->CopyToTemporaryFaviconFramesTable(old_id);
copied_favicons[old_id] = new_id;
} else {
// We already encountered a URL that used this favicon, use the ID we
@@ -2376,8 +2380,10 @@ bool HistoryBackend::ClearAllThumbnailHistory(URLRows* kept_urls) {
db_->ClearAndroidURLRows();
#endif
- // Rename the duplicate favicon and icon_mapping back table and recreate the
- // other tables. This will make the database consistent again.
+ // Drop original favicon_frames, favicons, and icon mappings tables and
+ // replace them with the duplicate tables. Recreate the other tables. This
+ // will make the database consistent again.
+ thumbnail_db_->CommitTemporaryFaviconFrameTable();
thumbnail_db_->CommitTemporaryFaviconTable();
thumbnail_db_->CommitTemporaryIconMappingTable();

Powered by Google App Engine
This is Rietveld 408576698