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

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

Issue 11341048: Populate versions on individual nodes in sync model and native bookmark model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head Created 8 years, 1 month 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/bookmark_model_associator.cc
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/chrome/browser/sync/glue/bookmark_model_associator.cc
index 165a4766808f1af01cb085bb924691386e035678..12a7ef528374d4fc460cc1c863a2c7784af2dae0 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.cc
+++ b/chrome/browser/sync/glue/bookmark_model_associator.cc
@@ -22,6 +22,7 @@
#include "sync/internal_api/public/read_transaction.h"
#include "sync/internal_api/public/write_node.h"
#include "sync/internal_api/public/write_transaction.h"
+#include "sync/syncable/write_transaction.h"
#include "sync/util/cryptographer.h"
#include "sync/util/data_type_histogram.h"
@@ -527,26 +528,34 @@ void BookmarkModelAssociator::PersistAssociations() {
return;
}
- syncer::WriteTransaction trans(FROM_HERE, user_share_);
- DirtyAssociationsSyncIds::iterator iter;
- for (iter = dirty_associations_sync_ids_.begin();
- iter != dirty_associations_sync_ids_.end();
- ++iter) {
- int64 sync_id = *iter;
- syncer::WriteNode sync_node(&trans);
- if (sync_node.InitByIdLookup(sync_id) != syncer::BaseNode::INIT_OK) {
- unrecoverable_error_handler_->OnSingleDatatypeUnrecoverableError(
- FROM_HERE,
- "Could not lookup bookmark node for ID persistence.");
- return;
+ int64 new_version = syncer::syncable::kInvalidTransactionVersion;
+ std::vector<const BookmarkNode*> bnodes;
+ {
+ syncer::WriteTransaction trans(FROM_HERE, user_share_, &new_version);
+ DirtyAssociationsSyncIds::iterator iter;
+ for (iter = dirty_associations_sync_ids_.begin();
+ iter != dirty_associations_sync_ids_.end();
+ ++iter) {
+ int64 sync_id = *iter;
+ syncer::WriteNode sync_node(&trans);
+ if (sync_node.InitByIdLookup(sync_id) != syncer::BaseNode::INIT_OK) {
+ unrecoverable_error_handler_->OnSingleDatatypeUnrecoverableError(
+ FROM_HERE,
+ "Could not lookup bookmark node for ID persistence.");
+ return;
+ }
+ const BookmarkNode* node = GetChromeNodeFromSyncId(sync_id);
+ if (node && sync_node.GetExternalId() != node->id()) {
+ sync_node.SetExternalId(node->id());
+ bnodes.push_back(node);
+ }
}
- const BookmarkNode* node = GetChromeNodeFromSyncId(sync_id);
- if (node)
- sync_node.SetExternalId(node->id());
- else
- NOTREACHED();
+ dirty_associations_sync_ids_.clear();
}
- dirty_associations_sync_ids_.clear();
+
+ BookmarkChangeProcessor::UpdateTransactionVersion(new_version,
+ bookmark_model_,
+ bnodes);
}
bool BookmarkModelAssociator::CryptoReadyIfNecessary() {
« no previous file with comments | « chrome/browser/sync/glue/bookmark_change_processor.cc ('k') | chrome/browser/sync/profile_sync_service_bookmark_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698