summaryrefslogtreecommitdiffstats
path: root/sync/engine/model_changing_syncer_command.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 17:59:48 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 17:59:48 +0000
commit79dc04cce3973949e5ad5effa8b634aaf5e25c2b (patch)
tree518abd7ca489e06c759048dcc80388d94e502fc0 /sync/engine/model_changing_syncer_command.cc
parent80771de8ce0c3f13c041cb03853174b95461a151 (diff)
downloadchromium_src-79dc04cce3973949e5ad5effa8b634aaf5e25c2b.zip
chromium_src-79dc04cce3973949e5ad5effa8b634aaf5e25c2b.tar.gz
chromium_src-79dc04cce3973949e5ad5effa8b634aaf5e25c2b.tar.bz2
Remove routing_info and workers from SyncSession
For all outward appearances, the SyncSession's workers and routing info will always precisely mirror those found in the SyncSessionContext. It is equivalent, and much simpler, to grab the latest routing info from the context wherever it's needed. Any SyncSession that makes it to a sync cycle will either have been initialized with the SyncSessionContext's routing info and workers, or Coalesced (set union) and Rebased (set intersection) with the SyncSessionContext's routing info and workers to the point where it's effectively equivalent to copying the context's data. Much of the logic to implement this book-keeping has been simplified in this patch. Configure mode is an important exception. While configuring, we would attempt to keep all currently enabled types enabled in the SyncSessionContext, while passing a restricted amount of routing info the the SyncSession. It turns out that it's not necessary to allow the SyncSessionContext and SyncSession routing info diverge in this case; it's OK to set the context's routing info to the restricted routes. In addition to trimming the session's routing info and workers list, RebaseRoutingInfoWithLatest was also responsible for trimming the list of notification hints to match the set of currently enabled types. This is redundant because the code in DownloadUpdatesCommand performs the same filtering using the same routing info. RebaseRoutingInfoWithLatest had no remaining useful features, so it was removed entirely. The Coalesce function still exists in a reduced form to handle merge sources between sessions. Its name and signature have been changed to reflect its new responsibilities. Without its own copy of the workers and routing info, the SyncSessionContext can no longer easily calculate the set of enabled groups. Fortunately, that information is only accessed by a single test case. The relevant code was moved into this test case. BUG=175024 Review URL: https://chromiumcodereview.appspot.com/12225091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182756 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine/model_changing_syncer_command.cc')
-rw-r--r--sync/engine/model_changing_syncer_command.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sync/engine/model_changing_syncer_command.cc b/sync/engine/model_changing_syncer_command.cc
index 3fe6b2d..c2c2750 100644
--- a/sync/engine/model_changing_syncer_command.cc
+++ b/sync/engine/model_changing_syncer_command.cc
@@ -19,8 +19,8 @@ SyncerError ModelChangingSyncerCommand::ExecuteImpl(
const std::set<ModelSafeGroup>& groups_to_change =
GetGroupsToChange(*work_session_);
- for (size_t i = 0; i < session->workers().size(); ++i) {
- ModelSafeWorker* worker = work_session_->workers()[i];
+ for (size_t i = 0; i < session->context()->workers().size(); ++i) {
+ ModelSafeWorker* worker = session->context()->workers()[i];
ModelSafeGroup group = worker->GetModelSafeGroup();
// Skip workers whose group isn't active.
if (groups_to_change.count(group) == 0u) {