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

Unified Diff: chrome/browser/history/android/favicon_sql_handler.cc

Issue 10917041: Cleanup FaviconSQLHandler::Update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 3 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 | « no previous file | chrome/browser/history/expire_history_backend_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/android/favicon_sql_handler.cc
diff --git a/chrome/browser/history/android/favicon_sql_handler.cc b/chrome/browser/history/android/favicon_sql_handler.cc
index dbf6eaf1bdc169741adf2a2ea8263b70ce194314..e9724285d643df863ded9fa4b5d9e28bfa697c55 100644
--- a/chrome/browser/history/android/favicon_sql_handler.cc
+++ b/chrome/browser/history/android/favicon_sql_handler.cc
@@ -51,22 +51,19 @@ bool FaviconSQLHandler::Update(const HistoryAndBookmarkRow& row,
std::vector<FaviconID> favicon_ids;
for (TableIDRows::const_iterator i = ids_set.begin();
i != ids_set.end(); ++i) {
+ // Remove existing icon mappings.
std::vector<IconMapping> icon_mappings;
- if (thumbnail_db_->GetIconMappingsForPageURL(i->url, FAVICON,
- &icon_mappings)) {
- if (favicon_id) {
- if (!thumbnail_db_->UpdateIconMapping(icon_mappings[0].mapping_id,
- favicon_id))
- return false;
- } else {
- // Require to delete the icon mapping.
- if (!thumbnail_db_->DeleteIconMappings(i->url))
- return false;
- }
+ thumbnail_db_->GetIconMappingsForPageURL(i->url, FAVICON,
+ &icon_mappings);
+ for (std::vector<IconMapping>::const_iterator m = icon_mappings.begin();
+ m != icon_mappings.end(); ++m) {
// Keep the old icon for deleting it later if possible.
- favicon_ids.push_back(icon_mappings[0].icon_id);
- } else if (favicon_id) {
- // The URL doesn't have icon before, add the icon mapping.
+ favicon_ids.push_back(m->icon_id);
+ }
+ if (!thumbnail_db_->DeleteIconMappings(i->url))
michaelbai 2012/09/07 00:29:59 This not right, you will delete all the mappings o
pkotwicz 2012/09/07 01:07:04 Is it the case, that in the case of favicon_id !=
+ return false;
+ if (favicon_id) {
+ // Add the icon mapping.
if (!thumbnail_db_->AddIconMapping(i->url, favicon_id))
return false;
}
« no previous file with comments | « no previous file | chrome/browser/history/expire_history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698