From 79dc04cce3973949e5ad5effa8b634aaf5e25c2b Mon Sep 17 00:00:00 2001 From: "rlarocque@chromium.org" Date: Fri, 15 Feb 2013 17:59:48 +0000 Subject: 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 --- sync/sessions/sync_session.h | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'sync/sessions/sync_session.h') diff --git a/sync/sessions/sync_session.h b/sync/sessions/sync_session.h index 901e3b5..7271b5f 100644 --- a/sync/sessions/sync_session.h +++ b/sync/sessions/sync_session.h @@ -97,9 +97,7 @@ class SYNC_EXPORT_PRIVATE SyncSession { SyncSession(SyncSessionContext* context, Delegate* delegate, - const SyncSourceInfo& source, - const ModelSafeRoutingInfo& routing_info, - const std::vector& workers); + const SyncSourceInfo& source); ~SyncSession(); // Builds a thread-safe and read-only copy of the current session state. @@ -114,20 +112,9 @@ class SYNC_EXPORT_PRIVATE SyncSession { // See SERVER_RETURN_* in the SyncerError enum for values. bool DidReachServer() const; - // Collects all state pertaining to how and why |s| originated and unions it - // with corresponding state in |this|, leaving |s| unchanged. Allows |this| - // to take on the responsibilities |s| had (e.g. certain data types) in the - // next SyncShare operation using |this|, rather than needed two separate - // sessions. - void Coalesce(const SyncSession& session); - - // Compares the routing_info_, workers and payload map with those passed in. - // Purges types from the above 3 which are not present in latest. Useful - // to update the sync session when the user has disabled some types from - // syncing. - void RebaseRoutingInfoWithLatest( - const ModelSafeRoutingInfo& routing_info, - const std::vector& workers); + // Overwrite the sync update source with the most recent and merge the + // type/state map. + void CoalesceSources(const SyncSourceInfo& source); // TODO(akalin): Split this into context() and mutable_context(). SyncSessionContext* context() const { return context_; } @@ -147,13 +134,8 @@ class SYNC_EXPORT_PRIVATE SyncSession { return &extensions_activity_; } - const std::vector& workers() const { return workers_; } - const ModelSafeRoutingInfo& routing_info() const { return routing_info_; } const SyncSourceInfo& source() const { return source_; } - // Returns the set of groups which have enabled types. - const std::set& GetEnabledGroups() const; - private: // Extend the encapsulation boundary to utilities for internal member // assignments. This way, the scope of these actions is explicit, they can't @@ -182,19 +164,6 @@ class SYNC_EXPORT_PRIVATE SyncSession { // Our controller for various status and error counters. scoped_ptr status_controller_; - // The set of active ModelSafeWorkers for the duration of this session. - // This can change if this session is Coalesce()'d with another. - std::vector workers_; - - // The routing info for the duration of this session, dictating which - // datatypes should be synced and which workers should be used when working - // on those datatypes. - ModelSafeRoutingInfo routing_info_; - - // The set of groups with enabled types. Computed from - // |routing_info_|. - std::set enabled_groups_; - DISALLOW_COPY_AND_ASSIGN(SyncSession); }; -- cgit v1.1