Chromium Code Reviews| 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(); |