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

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

Issue 10825325: [Sync] Dont upload an unrecoverable error for missing synced bookmark node (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 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 | « chrome/browser/sync/glue/bookmark_model_associator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 04fcb6ea724f7b0aed6d99e7df0db0f35f8b05a0..79ae54315377884087c8a1e534c843114fc93ee0 100644
--- a/chrome/browser/sync/glue/bookmark_model_associator.cc
+++ b/chrome/browser/sync/glue/bookmark_model_associator.cc
@@ -331,20 +331,17 @@ bool BookmarkModelAssociator::NodesMatch(
return true;
}
-syncer::SyncError BookmarkModelAssociator::AssociateTaggedPermanentNode(
+bool BookmarkModelAssociator::AssociateTaggedPermanentNode(
const BookmarkNode* permanent_node, const std::string&tag) {
// Do nothing if |permanent_node| is already initialized and associated.
int64 sync_id = GetSyncIdFromChromeId(permanent_node->id());
if (sync_id != syncer::kInvalidId)
- return syncer::SyncError();
+ return true;
if (!GetSyncIdForTaggedNode(tag, &sync_id))
- return unrecoverable_error_handler_->CreateAndUploadError(
- FROM_HERE,
- "Permanent node not found",
- model_type());
+ return false;
Associate(permanent_node, sync_id);
- return syncer::SyncError();
+ return true;
}
bool BookmarkModelAssociator::GetSyncIdForTaggedNode(const std::string& tag,
@@ -390,26 +387,34 @@ syncer::SyncError BookmarkModelAssociator::BuildAssociations() {
// This algorithm will not do well if the folder name has changes but the
// children under them are all the same.
- syncer::SyncError error;
DCHECK(bookmark_model_->IsLoaded());
// To prime our association, we associate the top-level nodes, Bookmark Bar
// and Other Bookmarks.
- error = AssociateTaggedPermanentNode(bookmark_model_->other_node(),
- kOtherBookmarksTag);
- if (error.IsSet())
- return error;
-
- error = AssociateTaggedPermanentNode(bookmark_model_->bookmark_bar_node(),
- kBookmarkBarTag);
- if (error.IsSet())
- return error;
-
- error = AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
- kMobileBookmarksTag);
- if (error.IsSet() && expect_mobile_bookmarks_folder_)
- return error;
- error = syncer::SyncError();
+ if (!AssociateTaggedPermanentNode(bookmark_model_->other_node(),
+ kOtherBookmarksTag)) {
+ return unrecoverable_error_handler_->CreateAndUploadError(
+ FROM_HERE,
+ "Other bookmarks node not found",
+ model_type());
+ }
+
+ if (!AssociateTaggedPermanentNode(bookmark_model_->bookmark_bar_node(),
+ kBookmarkBarTag)) {
+ return unrecoverable_error_handler_->CreateAndUploadError(
+ FROM_HERE,
+ "Bookmark bar node not found",
+ model_type());
+ }
+
+ if (!AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
+ kMobileBookmarksTag) &&
+ expect_mobile_bookmarks_folder_) {
+ return unrecoverable_error_handler_->CreateAndUploadError(
+ FROM_HERE,
+ "Mobile bookmarks node not found",
+ model_type());
+ }
int64 bookmark_bar_sync_id = GetSyncIdFromChromeId(
bookmark_model_->bookmark_bar_node()->id());
« no previous file with comments | « chrome/browser/sync/glue/bookmark_model_associator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698