diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 02:43:59 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-03 02:43:59 +0000 |
commit | d4cbf04aec5a509d2a434ff9e0f90a6e3dcf8807 (patch) | |
tree | 785604db14d01de2457f141f6f089c4fab3b0928 | |
parent | 62a39f15db3e8f632fae37fa08cdb2d611c96031 (diff) | |
download | chromium_src-d4cbf04aec5a509d2a434ff9e0f90a6e3dcf8807.zip chromium_src-d4cbf04aec5a509d2a434ff9e0f90a6e3dcf8807.tar.gz chromium_src-d4cbf04aec5a509d2a434ff9e0f90a6e3dcf8807.tar.bz2 |
Changes BookmarkModelAssociator not to fail if mobile folder doesn't
exist. This is a regression from
http://codereview.chromium.org/8759017
BUG=106238
TEST=none
R=akalin@chromium.org,yfriedman@chromium.org
Review URL: http://codereview.chromium.org/8790008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112851 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/glue/bookmark_model_associator.cc | 20 | ||||
-rw-r--r-- | chrome/browser/sync/glue/bookmark_model_associator.h | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/chrome/browser/sync/glue/bookmark_model_associator.cc index a010fad..bbdbff8 100644 --- a/chrome/browser/sync/glue/bookmark_model_associator.cc +++ b/chrome/browser/sync/glue/bookmark_model_associator.cc @@ -368,11 +368,10 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) { error->Reset(FROM_HERE, kServerError, model_type()); return false; } - if (!AssociateTaggedPermanentNode(bookmark_model_->mobile_node(), - kMobileBookmarksTag)) { - error->Reset(FROM_HERE, kServerError, model_type()); - return false; - } + // The mobile folder isn't always present on the backend, so we don't fail if + // it doesn't exist. + ignore_result(AssociateTaggedPermanentNode(bookmark_model_->mobile_node(), + kMobileBookmarksTag)); int64 bookmark_bar_sync_id = GetSyncIdFromChromeId( bookmark_model_->bookmark_bar_node()->id()); DCHECK_NE(bookmark_bar_sync_id, sync_api::kInvalidId); @@ -381,7 +380,6 @@ bool BookmarkModelAssociator::BuildAssociations(SyncError* error) { DCHECK_NE(other_bookmarks_sync_id, sync_api::kInvalidId); int64 mobile_bookmarks_sync_id = GetSyncIdFromChromeId( bookmark_model_->mobile_node()->id()); - DCHECK_NE(mobile_bookmarks_sync_id, sync_api::kInvalidId); std::stack<int64> dfs_stack; if (mobile_bookmarks_sync_id != sync_api::kInvalidId) @@ -525,10 +523,9 @@ bool BookmarkModelAssociator::LoadAssociations() { return false; } int64 mobile_bookmarks_id = -1; - if (!GetSyncIdForTaggedNode(kMobileBookmarksTag, &mobile_bookmarks_id)) { - // We should always be able to find the permanent nodes. - return false; - } + // Can't fail here as the mobile folder may not exist. + ignore_result( + GetSyncIdForTaggedNode(kMobileBookmarksTag, &mobile_bookmarks_id)); // Build a bookmark node ID index since we are going to repeatedly search for // bookmark nodes by their IDs. @@ -538,7 +535,8 @@ bool BookmarkModelAssociator::LoadAssociations() { id_index.AddAll(bookmark_model_->mobile_node()); std::stack<int64> dfs_stack; - dfs_stack.push(mobile_bookmarks_id); + if (mobile_bookmarks_id != -1) + dfs_stack.push(mobile_bookmarks_id); dfs_stack.push(other_bookmarks_id); dfs_stack.push(bookmark_bar_id); diff --git a/chrome/browser/sync/glue/bookmark_model_associator.h b/chrome/browser/sync/glue/bookmark_model_associator.h index 2282031..400b98e 100644 --- a/chrome/browser/sync/glue/bookmark_model_associator.h +++ b/chrome/browser/sync/glue/bookmark_model_associator.h @@ -116,7 +116,7 @@ class BookmarkModelAssociator // user's share. For example, "other_bookmarks" is the tag for the Other // Bookmarks folder. The sync nodes are server-created. bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node, - const std::string& tag); + const std::string& tag) WARN_UNUSED_RESULT; // Compare the properties of a pair of nodes from either domain. bool NodesMatch(const BookmarkNode* bookmark, |