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

Issue 904083002: Use external ID to match native model nodes during bookmark association. (Closed)

Created:
5 years, 10 months ago by stanisc
Modified:
5 years, 10 months ago
Reviewers:
Nicolas Zea
CC:
chromium-reviews, tim+watch_chromium.org, pvalenzuela+watch_chromium.org, maxbogue+watch_chromium.org, zea+watch_chromium.org, maniscalco+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use external ID to match native model nodes during bookmark association. The fix improves matching of nodes in BookmarkModelAssociator in situations where there are multiple bookmarks or folders with the same titles or URLs. This will address one particular scenario leading to bookmark duplication (see crbug.com/118105). 1) In BookmarkModelAssociator::BuildAssociations, when there are multiple native model nodes with matching title / URL, a secondary match on external ID is used to pick a preferred one; otherwise the first matching node is returned. The preferred match on external ID should be applicable in most situations except when the native model has been rebuilt from scratch. Picking a wrong folder during the association process results in duplicating the entire subtree within the wrong folder. This issue should be addressed now. 2) In BookmarkModelAssociator::ApplyDeletesFromSyncJournal the external ID match is now the primary criteria for selecting a native model node to be deleted. The previous implementation would pick an arbitrary native model node based on just the title / URL match anywhere in the node hierarchy. That would happen every time after deleting a bookmark or folder and recreating it in another place. Since external IDs might be reused, there is a secondary match on title and URL to ensure that the right node gets deleted. To avoid costly O(N*M) algorithm (where N is number of bookmarks and M is number of entries in delete journal), the implementation uses a set of external IDs to reduce the cost to O(N*logM). BUG=456228 Committed: https://crrev.com/89fce43a19e7f8b0225a0d750ec3eb3cb0939e3d Cr-Commit-Position: refs/heads/master@{#315401}

Patch Set 1 : #

Total comments: 20

Patch Set 2 : Addressed CR feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+312 lines, -82 lines) Patch
M chrome/browser/sync/glue/bookmark_model_associator.h View 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/sync/glue/bookmark_model_associator.cc View 1 9 chunks +116 lines, -69 lines 0 comments Download
M chrome/browser/sync/profile_sync_service_bookmark_unittest.cc View 1 4 chunks +193 lines, -9 lines 0 comments Download
M sync/internal_api/delete_journal.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M sync/internal_api/public/delete_journal.h View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 11 (3 generated)
stanisc
PTAL.
5 years, 10 months ago (2015-02-06 22:30:27 UTC) #3
Nicolas Zea
Nice. Couple comments. https://codereview.chromium.org/904083002/diff/20001/chrome/browser/sync/glue/bookmark_model_associator.cc File chrome/browser/sync/glue/bookmark_model_associator.cc (right): https://codereview.chromium.org/904083002/diff/20001/chrome/browser/sync/glue/bookmark_model_associator.cc#newcode80 chrome/browser/sync/glue/bookmark_model_associator.cc:80: // If there are multiple matches ...
5 years, 10 months ago (2015-02-06 23:34:19 UTC) #4
stanisc
https://codereview.chromium.org/904083002/diff/20001/chrome/browser/sync/glue/bookmark_model_associator.cc File chrome/browser/sync/glue/bookmark_model_associator.cc (right): https://codereview.chromium.org/904083002/diff/20001/chrome/browser/sync/glue/bookmark_model_associator.cc#newcode80 chrome/browser/sync/glue/bookmark_model_associator.cc:80: // If there are multiple matches than a node ...
5 years, 10 months ago (2015-02-09 19:15:38 UTC) #5
Nicolas Zea
LGTM
5 years, 10 months ago (2015-02-09 20:39:36 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/904083002/40001
5 years, 10 months ago (2015-02-09 21:49:54 UTC) #8
commit-bot: I haz the power
Committed patchset #2 (id:40001)
5 years, 10 months ago (2015-02-09 21:54:47 UTC) #9
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/89fce43a19e7f8b0225a0d750ec3eb3cb0939e3d Cr-Commit-Position: refs/heads/master@{#315401}
5 years, 10 months ago (2015-02-09 21:55:15 UTC) #10
Ryan Hamilton
5 years, 10 months ago (2015-02-10 00:05:31 UTC) #11
Message was sent while issue was closed.
A revert of this CL (patchset #2 id:40001) has been created in
https://codereview.chromium.org/906403003/ by rch@chromium.org.

The reason for reverting is: Looks like it broke a sync_unittest

http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%28...

(But maybe it's a flake?).

Powered by Google App Engine
This is Rietveld 408576698