Index: chrome/browser/history/history_backend.cc |
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc |
index 34a0a30b2e08a7561fb6e5b7d50d8312fd1cab8d..e5a7c14bbf0b07d2a05f1a75e642d5344f2a1625 100644 |
--- a/chrome/browser/history/history_backend.cc |
+++ b/chrome/browser/history/history_backend.cc |
@@ -1931,6 +1931,13 @@ void HistoryBackend::MergeFavicon( |
bool replaced_bitmap = false; |
for (size_t i = 0; i < bitmap_id_sizes.size(); ++i) { |
if (bitmap_id_sizes[i].pixel_size == pixel_size) { |
+ if (IsFaviconBitmapDataEqual(bitmap_id_sizes[i].bitmap_id, bitmap_data)) { |
+ thumbnail_db_->SetFaviconBitmapLastUpdateTime( |
+ bitmap_id_sizes[i].bitmap_id, base::Time::Now()); |
+ // Return early as merging did not alter the bitmap data. |
+ ScheduleCommit(); |
+ return; |
+ } |
thumbnail_db_->SetFaviconBitmap(bitmap_id_sizes[i].bitmap_id, bitmap_data, |
base::Time::Now()); |
replaced_bitmap = true; |
@@ -2316,6 +2323,20 @@ void HistoryBackend::SetFaviconSizes(FaviconID icon_id, |
thumbnail_db_->SetFaviconSizes(icon_id, favicon_sizes); |
} |
+bool HistoryBackend::IsFaviconBitmapDataEqual( |
+ FaviconBitmapID bitmap_id, |
+ const scoped_refptr<base::RefCountedMemory>& new_bitmap_data) { |
+ if (!new_bitmap_data.get()) |
+ return false; |
+ |
+ scoped_refptr<base::RefCountedMemory> original_bitmap_data; |
+ thumbnail_db_->GetFaviconBitmap(bitmap_id, |
+ NULL, |
+ &original_bitmap_data, |
+ NULL); |
+ return new_bitmap_data->Equals(original_bitmap_data); |
+} |
+ |
bool HistoryBackend::GetFaviconsFromDB( |
const GURL& page_url, |
int icon_types, |