Commit 01334e45 authored by zea@chromium.org's avatar zea@chromium.org

[Sync] Dont upload an unrecoverable error for missing synced bookmark node

We were uploading when failing to associate the synced bookmarks node,
regardless of whether we expected it or not. Now we do the upload
at a layer above, where we know whether we care or not.

BUG=142387
TEST=Signing into sync on an account with no mobile devices should not
trigger an unrecoverable error upload.


Review URL: https://chromiumcodereview.appspot.com/10825325

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151356 0039d316-1c4b-4281-b951-d872f2087c98
parent 1554a331
......@@ -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());
......
......@@ -124,7 +124,8 @@ class BookmarkModelAssociator
// well known to the server and the client, and is unique within a particular
// user's share. For example, "other_bookmarks" is the tag for the Other
// Bookmarks folder. The sync nodes are server-created.
syncer::SyncError AssociateTaggedPermanentNode(
// Returns true on success, false if association failed.
bool AssociateTaggedPermanentNode(
const BookmarkNode* permanent_node,
const std::string& tag) WARN_UNUSED_RESULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment