| Index: sync/sessions/status_controller.h
|
| diff --git a/sync/sessions/status_controller.h b/sync/sessions/status_controller.h
|
| index 752d07d7b31fbb137a63671b0107cc72462c33b0..0f7f71e0abffe694712b5d72fbf6f5c49696576d 100644
|
| --- a/sync/sessions/status_controller.h
|
| +++ b/sync/sessions/status_controller.h
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +// FIXME: rewrite this comment.
|
| // 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
|
| @@ -40,7 +41,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,22 +50,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 ConflictProgress* conflict_progress() const;
|
| - ConflictProgress* mutable_conflict_progress();
|
| - const UpdateProgress* update_progress() const;
|
| - UpdateProgress* mutable_update_progress();
|
| - const ConflictProgress* GetUnrestrictedConflictProgress(
|
| - ModelSafeGroup group) const;
|
| - ConflictProgress* GetUnrestrictedMutableConflictProgressForTest(
|
| - ModelSafeGroup group);
|
| - const UpdateProgress* GetUnrestrictedUpdateProgress(
|
| - ModelSafeGroup group) const;
|
| - UpdateProgress* GetUnrestrictedMutableUpdateProgressForTest(
|
| - ModelSafeGroup group);
|
| -
|
| // ClientToServer messages.
|
| const ModelTypeSet updates_request_types() const {
|
| return model_neutral_.updates_request_types;
|
| @@ -92,28 +76,20 @@ class StatusController {
|
| return commit_set.GetCommitIdProjection(group_restriction_);
|
| }
|
|
|
| - // Control parameters for sync cycles.
|
| - bool conflicts_resolved() const {
|
| - return model_neutral_.conflicts_resolved;
|
| - }
|
| + // Various conflict counters.
|
| + // FIXME: probably unnecessary. Maybe should just access members directly?
|
| + int num_encryption_conflicts() const;
|
| + int num_hierarchy_conflicts() const;
|
| + int num_server_conflicts() const;
|
|
|
| - // 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;
|
| -
|
| - // Aggregate sums of various types of conflict counters accross all
|
| - // ConflictProgress objects (one for each ModelSafeGroup currently in-use).
|
| - int TotalNumEncryptionConflictingItems() const;
|
| - int TotalNumHierarchyConflictingItems() const;
|
| - int TotalNumServerConflictingItems() const;
|
| - int TotalNumSimpleConflictingItems() const;
|
| -
|
| - // Aggregate sum of SimpleConflictingItemSize() and other
|
| - // ${Type}ConflictingItemSize() methods over all ConflictProgress objects (one
|
| - // for each ModelSafeGroup currently in-use).
|
| + // Aggregate sum of all conflict types.
|
| int TotalNumConflictingItems() const;
|
|
|
| + // Number of successfully applied updates.
|
| + int num_updates_applied() const;
|
| +
|
| + int num_server_overwrites() const;
|
| +
|
| // Returns the number of updates received from the sync server.
|
| int64 CountUpdates() const;
|
|
|
| @@ -151,24 +127,33 @@ class StatusController {
|
|
|
| SyncerError last_get_key_result() const;
|
|
|
| - // A toolbelt full of methods for updating counters and flags.
|
| + // Download counters.
|
| void set_num_server_changes_remaining(int64 changes_remaining);
|
| - void set_num_successful_bookmark_commits(int value);
|
| - void increment_num_successful_commits();
|
| - void increment_num_successful_bookmark_commits();
|
| void increment_num_updates_downloaded_by(int value);
|
| void increment_num_tombstone_updates_downloaded_by(int value);
|
| void increment_num_reflected_updates_downloaded_by(int value);
|
| - void set_types_needing_local_migration(ModelTypeSet types);
|
| +
|
| + // Update application and conflict resolution counters.
|
| + void increment_num_updates_applied_by(int value);
|
| + void increment_num_encryption_conflicts_by(int value);
|
| + void increment_num_hierarchy_conflicts_by(int value);
|
| + void increment_num_server_conflicts();
|
| void increment_num_local_overwrites();
|
| void increment_num_server_overwrites();
|
| +
|
| + // Commit counters.
|
| + void increment_num_successful_commits();
|
| + void increment_num_successful_bookmark_commits();
|
| + void set_num_successful_bookmark_commits(int value);
|
| +
|
| + // Server communication status tracking.
|
| void set_sync_protocol_error(const SyncProtocolError& error);
|
| void set_last_get_key_result(const SyncerError result);
|
| void set_last_download_updates_result(const SyncerError result);
|
| void set_commit_result(const SyncerError result);
|
|
|
| - void update_conflicts_resolved(bool resolved);
|
| - void reset_conflicts_resolved();
|
| + // A very important flag used to inform frontend of need to migrate.
|
| + void set_types_needing_local_migration(ModelTypeSet types);
|
|
|
| void UpdateStartTime();
|
|
|
| @@ -190,19 +175,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.
|
|
|