summaryrefslogtreecommitdiffstats
path: root/sync/sessions/status_controller.h
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 19:38:49 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 19:38:49 +0000
commitb2b06c4f160763133874468c5f6715afc8832e06 (patch)
treeaf1073bd57694a30b8cc2eac9979853421ab786a /sync/sessions/status_controller.h
parent6df3b33eb6ff9bb594d7207a2713cbb8f3fca6da (diff)
downloadchromium_src-b2b06c4f160763133874468c5f6715afc8832e06.zip
chromium_src-b2b06c4f160763133874468c5f6715afc8832e06.tar.gz
chromium_src-b2b06c4f160763133874468c5f6715afc8832e06.tar.bz2
sync: Follow-up to conflict resolution refactor
This is part two of r164286. That commit refactored the way we handle conflict resolution. This commit takes advantage of those changes to delete lots of code. Because this change deletes session_state.cc, I decided to move the two remaining useful tests session_state_unittest.cc into their own files, sync_session_snapshot_unittest.cc and sync_source_info_unittest.cc. The tests were not modified in any way. None of these changes should have any effect on syncer behaviour: - We can remove the simple conflict counters and related code, since we now assert that all conflicts will be resolved by the end of a successful sync cycle. - We can remove the PerModelSafeGroupState because that struct no longer has any members. - The 'conflicts_resolved' indicators are no longer set, so we can remove them. - Without those indicators, it's no longer possible to have any SYNC_CYCLE_CONTINUATION sync cycles. We can remove a few counters associated with them, as well as the 'has_more_to_sync' flag in the snapshot. - Without SYNC_CYCLE_CONTINUATION cycles, there's no longer any need for code that loops around SyncShare() in SyncSchedulerImpl. The SyncSession::PrepareForAnotherSyncCycle() function is no longer used, either. - The ScopedConflictResolver installed on the session during a sync cycle is no longer used, so all the code related to it can be deleted. BUG=147681,111280,156238 Review URL: https://chromiumcodereview.appspot.com/11314008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions/status_controller.h')
-rw-r--r--sync/sessions/status_controller.h61
1 files changed, 10 insertions, 51 deletions
diff --git a/sync/sessions/status_controller.h b/sync/sessions/status_controller.h
index 0717b6e..9e1e73c 100644
--- a/sync/sessions/status_controller.h
+++ b/sync/sessions/status_controller.h
@@ -3,20 +3,16 @@
// found in the LICENSE file.
// StatusController handles all counter and status related number crunching and
-// state tracking on behalf of a SyncSession. It 'controls' the model data
-// defined in session_state.h. The most important feature of StatusController
-// is the ScopedModelSafetyRestriction. When one of these is active, the
-// underlying data set exposed via accessors is swapped out to the appropriate
-// set for the restricted ModelSafeGroup behind the scenes. For example, if
-// GROUP_UI is set, then accessors such as conflict_progress() and commit_ids()
-// are implicitly restricted to returning only data pertaining to GROUP_UI.
-// You can see which parts of status fall into this "restricted" category, or
-// the global "shared" category for all model types, by looking at the struct
-// declarations in session_state.h. If these accessors are invoked without a
-// restriction in place, this is a violation and will cause debug assertions
-// to surface improper use of the API in development. Likewise for
-// invocation of "shared" accessors when a restriction is in place; for
-// safety's sake, an assertion will fire.
+// state tracking on behalf of a SyncSession.
+//
+// The most important feature of StatusController is the
+// ScopedModelSafeGroupRestriction. Some of its functions expose per-thread
+// state, and can be called only when the restriction is in effect. For
+// example, if GROUP_UI is set then the value returned from
+// commit_id_projection() will be useful for iterating over the commit IDs of
+// items that live on the UI thread.
+//
+// Other parts of its state are global, and do not require the restriction.
//
// NOTE: There is no concurrent access protection provided by this class. It
// assumes one single thread is accessing this class for each unique
@@ -40,7 +36,6 @@
#include "base/time.h"
#include "sync/internal_api/public/sessions/model_neutral_state.h"
#include "sync/sessions/ordered_commit_set.h"
-#include "sync/sessions/session_state.h"
namespace syncer {
namespace sessions {
@@ -50,14 +45,6 @@ class StatusController {
explicit StatusController(const ModelSafeRoutingInfo& routes);
~StatusController();
- // Progress counters. All const methods may return NULL if the
- // progress structure doesn't exist, but all non-const methods
- // auto-create.
- const std::set<syncable::Id>* simple_conflict_ids() const;
- std::set<syncable::Id>* mutable_simple_conflict_ids();
- const std::set<syncable::Id>* GetUnrestrictedSimpleConflictIds(
- ModelSafeGroup group) const;
-
// ClientToServer messages.
const ModelTypeSet updates_request_types() const {
return model_neutral_.updates_request_types;
@@ -84,23 +71,11 @@ class StatusController {
return commit_set.GetCommitIdProjection(group_restriction_);
}
- // Control parameters for sync cycles.
- bool conflicts_resolved() const {
- return model_neutral_.conflicts_resolved;
- }
-
- // If a GetUpdates for any data type resulted in downloading an update that
- // is in conflict, this method returns true.
- // Note: this includes unresolvable conflicts.
- bool HasConflictingUpdates() const;
-
// Various conflict counters.
int num_encryption_conflicts() const;
int num_hierarchy_conflicts() const;
int num_server_conflicts() const;
- int num_simple_conflicts() const;
-
// Aggregate sum of all conflicting items over all conflict types.
int TotalNumConflictingItems() const;
@@ -160,10 +135,6 @@ class StatusController {
void increment_num_local_overwrites();
void increment_num_server_overwrites();
- // TODO(rlarocque): Remove these after conflict resolution refactor.
- void update_conflicts_resolved(bool resolved);
- void reset_conflicts_resolved();
-
// Commit counters.
void increment_num_successful_commits();
void increment_num_successful_bookmark_commits();
@@ -198,19 +169,7 @@ class StatusController {
return group_restriction() == it->second;
}
- // Returns the state, if it exists, or NULL otherwise.
- const PerModelSafeGroupState* GetModelSafeGroupState(
- bool restrict, ModelSafeGroup group) const;
-
- // Helper to lazily create objects for per-ModelSafeGroup state.
- PerModelSafeGroupState* GetOrCreateModelSafeGroupState(
- bool restrict, ModelSafeGroup group);
-
ModelNeutralState model_neutral_;
- std::map<ModelSafeGroup, PerModelSafeGroupState*> per_model_group_;
-
- STLValueDeleter<std::map<ModelSafeGroup, PerModelSafeGroupState*> >
- per_model_group_deleter_;
// Used to fail read/write operations on state that don't obey the current
// active ModelSafeWorker contract.