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

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

Issue 12253010: [sync] Fix deadlock in SessionModelAssociator for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment explaining why we moved it out of the block Created 7 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/session_model_associator.cc
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 19109b7c879d30abd3f0640659ae7437d1083efb..37488be2e5bc69e5b28a61742eaf18830afa15c0 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -613,6 +613,9 @@ syncer::SyncError SessionModelAssociator::AssociateModels(
scoped_ptr<DeviceInfo> local_device_info(sync_service_->GetLocalDeviceInfo());
+#if defined(OS_ANDROID)
+ std::string transaction_tag;
+#endif
// Read any available foreign sessions and load any session data we may have.
// If we don't have any local session data in the db, create a header node.
{
@@ -672,11 +675,16 @@ syncer::SyncError SessionModelAssociator::AssociateModels(
local_session_syncid_ = write_node.GetId();
}
#if defined(OS_ANDROID)
- std::string transaction_tag = GetMachineTagFromTransaction(&trans);
- if (current_machine_tag_.compare(transaction_tag) != 0)
- DeleteForeignSession(transaction_tag);
+ transaction_tag = GetMachineTagFromTransaction(&trans);
#endif
}
+#if defined(OS_ANDROID)
+ // We need to delete foreign sessions after giving up our
+ // syncer::WriteTransaction, since DeleteForeignSession(std::string&) uses
+ // its own syncer::WriteTransaction.
+ if (current_machine_tag_.compare(transaction_tag) != 0)
+ DeleteForeignSession(transaction_tag);
+#endif
// Check if anything has changed on the client side.
if (!UpdateSyncModelDataFromClient(&error)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698