| 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 846d3e2955ca37e85cb2b923c07d96db00f32f92..2782ec22efe671c04c7f527c74d10e1970024d19 100644
|
| --- a/chrome/browser/sync/glue/bookmark_model_associator.cc
|
| +++ b/chrome/browser/sync/glue/bookmark_model_associator.cc
|
| @@ -364,7 +364,10 @@ bool BookmarkModelAssociator::GetSyncIdForTaggedNode(const std::string& tag,
|
| syncer::SyncError BookmarkModelAssociator::AssociateModels(
|
| syncer::SyncMergeResult* local_merge_result,
|
| syncer::SyncMergeResult* syncer_merge_result) {
|
| - CheckModelSyncState(local_merge_result, syncer_merge_result);
|
| + syncer::SyncError error = CheckModelSyncState(local_merge_result,
|
| + syncer_merge_result);
|
| + if (error.IsSet())
|
| + return error;
|
|
|
| scoped_ptr<ScopedAssociationUpdater> association_updater(
|
| new ScopedAssociationUpdater(bookmark_model_));
|
| @@ -702,16 +705,16 @@ bool BookmarkModelAssociator::CryptoReadyIfNecessary() {
|
| trans.GetCryptographer()->is_ready();
|
| }
|
|
|
| -void BookmarkModelAssociator::CheckModelSyncState(
|
| +syncer::SyncError BookmarkModelAssociator::CheckModelSyncState(
|
| syncer::SyncMergeResult* local_merge_result,
|
| syncer::SyncMergeResult* syncer_merge_result) const {
|
| std::string version_str;
|
| if (bookmark_model_->root_node()->GetMetaInfo(kBookmarkTransactionVersionKey,
|
| &version_str)) {
|
| syncer::ReadTransaction trans(FROM_HERE, user_share_);
|
| - int64 native_version;
|
| + int64 native_version = syncer::syncable::kInvalidTransactionVersion;
|
| if (!base::StringToInt64(version_str, &native_version))
|
| - return;
|
| + return syncer::SyncError();
|
| local_merge_result->set_pre_association_version(native_version);
|
|
|
| int64 sync_version = trans.GetModelVersion(syncer::BOOKMARKS);
|
| @@ -721,11 +724,21 @@ void BookmarkModelAssociator::CheckModelSyncState(
|
| UMA_HISTOGRAM_ENUMERATION("Sync.LocalModelOutOfSync",
|
| ModelTypeToHistogramInt(syncer::BOOKMARKS),
|
| syncer::MODEL_TYPE_COUNT);
|
| +
|
| // Clear version on bookmark model so that we only report error once.
|
| bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(),
|
| kBookmarkTransactionVersionKey);
|
| +
|
| + // If the native version is higher, there was a sync persistence failure,
|
| + // and we need to delay association until after a GetUpdates.
|
| + if (sync_version < native_version) {
|
| + DVLOG(1) << "Native version (" << native_version << ") does not match "
|
| + << "sync version (" << sync_version << ").";
|
| + // TODO(zea): return a persistence error here.
|
| + }
|
| }
|
| }
|
| + return syncer::SyncError();
|
| }
|
|
|
| } // namespace browser_sync
|
|
|