summaryrefslogtreecommitdiffstats
path: root/sync/internal_api
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/internal_api
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/internal_api')
-rw-r--r--sync/internal_api/public/base/model_type_invalidation_map.cc4
-rw-r--r--sync/internal_api/public/base/model_type_invalidation_map.h4
-rw-r--r--sync/internal_api/public/base/model_type_invalidation_map_unittest.cc2
3 files changed, 5 insertions, 5 deletions
diff --git a/sync/internal_api/public/base/model_type_invalidation_map.cc b/sync/internal_api/public/base/model_type_invalidation_map.cc
index 1084947..65a125f 100644
--- a/sync/internal_api/public/base/model_type_invalidation_map.cc
+++ b/sync/internal_api/public/base/model_type_invalidation_map.cc
@@ -56,8 +56,8 @@ DictionaryValue* ModelTypeInvalidationMapToValue(
return value;
}
-void CoalesceStates(ModelTypeInvalidationMap* original,
- const ModelTypeInvalidationMap& update) {
+void CoalesceStates(const ModelTypeInvalidationMap& update,
+ ModelTypeInvalidationMap* original) {
// TODO(dcheng): Where is this called? Do we need to add more clever logic for
// handling ack_handle? We probably want to always use the "latest"
// ack_handle, which might imply always using the one in update?
diff --git a/sync/internal_api/public/base/model_type_invalidation_map.h b/sync/internal_api/public/base/model_type_invalidation_map.h
index 9216562..462e17e 100644
--- a/sync/internal_api/public/base/model_type_invalidation_map.h
+++ b/sync/internal_api/public/base/model_type_invalidation_map.h
@@ -45,8 +45,8 @@ SYNC_EXPORT_PRIVATE base::DictionaryValue* ModelTypeInvalidationMapToValue(
// Coalesce |update| into |original|, overwriting only when |update| has
// a non-empty payload.
-SYNC_EXPORT_PRIVATE void CoalesceStates(ModelTypeInvalidationMap* original,
- const ModelTypeInvalidationMap& update);
+SYNC_EXPORT_PRIVATE void CoalesceStates(
+ const ModelTypeInvalidationMap& update, ModelTypeInvalidationMap* original);
} // namespace syncer
diff --git a/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc b/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc
index 2b1049b..f051479 100644
--- a/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc
+++ b/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc
@@ -57,7 +57,7 @@ TEST_F(ModelTypeInvalidationMapTest, CoalesceStates) {
update[SESSIONS].payload = payload2; // New.
// Themes untouched.
- CoalesceStates(&original, update);
+ CoalesceStates(update, &original);
ASSERT_EQ(5U, original.size());
EXPECT_EQ(empty_payload, original[BOOKMARKS].payload);
EXPECT_EQ(payload1, original[PASSWORDS].payload);