Dont send ADD for implicitly created app list folders during inital sync
commitadfa93a5437150879c88fa0982d3b8a46fd7f9a5
authorstevenjb <stevenjb@chromium.org>
Wed, 17 Sep 2014 18:12:47 +0000 (17 11:12 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 17 Sep 2014 18:12:56 +0000 (17 18:12 +0000)
treea2f34d0abd219cfe58f7ab6229c64eaf1ec0f943
parent314a240ec3fd6a40f9e2e543fa692eb44d667ab2
Dont send ADD for implicitly created app list folders during inital sync

When processing the initial list of sync items, an item with parent_id
set to non-empty may trigger the creation of a new folder item, which
may trigger sending a sync ADD event for a sync item that already exists
(later in the list). The sync code treats an ADD request for an existing
item as a fatal error.

To prevent that, this CL disables sending ADD events while processing the
initial list; when the item is processed the newly created folder
SyncItem will be updated to reflect the initial sync list entry.

Note: An alternative approach would be to process the initial list twice,
creating folder items first then other items. Even though the change in
this CL is somewhat subtle, it is a much smaller change than processing
the list twice twice would be, and I think that processing the list twice
would  ultimately be more error prone. That said, I could be convinced
otherwise.

BUG=380537

Review URL: https://codereview.chromium.org/580653002

Cr-Commit-Position: refs/heads/master@{#295300}
chrome/browser/ui/app_list/app_list_syncable_service.cc
chrome/browser/ui/app_list/app_list_syncable_service.h