[Sync] Avoid erroneous re-entrancy when model association times out.
commite8e5b6435ce01f868540e92ed7fff8a4043f8345
authormaniscalco <maniscalco@chromium.org>
Fri, 3 Oct 2014 01:58:34 +0000 (2 18:58 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 3 Oct 2014 01:58:52 +0000 (3 01:58 +0000)
tree64509b7cdd54b47247412cc425b0e366cbb0a4d6
parent5a14236a9c2a7b9191c31ddccc5f1d7a4f6278a9
[Sync] Avoid erroneous re-entrancy when model association times out.

This change fixes a bug where model association timeout can cause a
std::queue in DataTypeManagerImpl to be .pop()d when it's already empty.
See linked bug for more information.

Prior to this change, when model load is aborted (AbortModelLoad) the
model's ModelLoadCallback would be invoked.  After this change, the
ModelLoadCallback will not be invoked when AbortModelLoad is called.

Update existing unit test so they no longer expect a call to
ModelLoadCallback when aborting.

Add CHECKs to DataTypeManagerImpl to ensure it never .pop()s an empty
stl::queue.

Add unit test to DataTypeManagerImpl to repro this bug.

BUG=419034

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

Cr-Commit-Position: refs/heads/master@{#297967}
chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
chrome/browser/sync/glue/frontend_data_type_controller.cc
chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc
chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc
components/sync_driver/data_type_manager_impl.cc
components/sync_driver/data_type_manager_impl_unittest.cc
components/sync_driver/non_ui_data_type_controller.cc
components/sync_driver/non_ui_data_type_controller_unittest.cc
components/sync_driver/ui_data_type_controller.cc