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

Unified Diff: chrome/browser/sync/glue/favicon_cache.cc

Issue 13006012: [Sync] Fix double tranaction acquire in favicon code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/sync/glue/favicon_cache.cc
diff --git a/chrome/browser/sync/glue/favicon_cache.cc b/chrome/browser/sync/glue/favicon_cache.cc
index a1dc8fa592ef18bbe2ae7846a8824d4bd5433f5e..def27faf2ad79c59bd55bf3a0397ae21211d097d 100644
--- a/chrome/browser/sync/glue/favicon_cache.cc
+++ b/chrome/browser/sync/glue/favicon_cache.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/sync/glue/favicon_cache.h"
+#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
@@ -484,7 +485,15 @@ void FaviconCache::OnReceivedSyncFavicon(const GURL& page_url,
favicon_info->bitmap_data[SIZE_16].pixel_size.set_width(16);
favicon_info->bitmap_data[SIZE_16].pixel_size.set_height(16);
UpdateFaviconVisitTime(icon_url, syncer::ProtoTimeToTime(visit_time_ms));
- UpdateSyncState(icon_url, SYNC_BOTH, syncer::SyncChange::ACTION_ADD);
+
+ // Post a task, as this can be called while still in a transaction.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&FaviconCache::UpdateSyncState,
+ weak_ptr_factory_.GetWeakPtr(),
+ icon_url,
+ SYNC_BOTH,
+ syncer::SyncChange::ACTION_ADD));
}
void FaviconCache::SetLegacyDelegate(FaviconCacheObserver* observer) {

Powered by Google App Engine
This is Rietveld 408576698