Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7184)

Unified Diff: chrome/browser/sync/sessions/status_controller.h

Issue 8638001: [Sync] Made some sync session member functions const (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix latent bug in StatusController Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/sessions/session_state.cc ('k') | chrome/browser/sync/sessions/status_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sessions/status_controller.h
diff --git a/chrome/browser/sync/sessions/status_controller.h b/chrome/browser/sync/sessions/status_controller.h
index ec1437d14a72e9056e0aabc94ad2b497b09cc977..c0782cb5f52ffcc1f4d732f15f9106fb00ec8741 100644
--- a/chrome/browser/sync/sessions/status_controller.h
+++ b/chrome/browser/sync/sessions/status_controller.h
@@ -36,6 +36,7 @@
#include <vector>
#include <map>
+#include "base/logging.h"
#include "base/stl_util.h"
#include "base/time.h"
#include "chrome/browser/sync/sessions/ordered_commit_set.h"
@@ -53,28 +54,17 @@ class StatusController {
// since it was created or was last reset.
bool TestAndClearIsDirty();
- // Progress counters.
- const ConflictProgress& conflict_progress() {
- return GetOrCreateModelSafeGroupState(true,
- group_restriction_)->conflict_progress;
- }
- ConflictProgress* mutable_conflict_progress() {
- return &GetOrCreateModelSafeGroupState(true,
- group_restriction_)->conflict_progress;
- }
- const UpdateProgress& update_progress() {
- return GetOrCreateModelSafeGroupState(true,
- group_restriction_)->update_progress;
- }
- UpdateProgress* mutable_update_progress() {
- return &GetOrCreateModelSafeGroupState(true,
- group_restriction_)->update_progress;
- }
- // Some unrestricted, non-ModelChangingSyncerCommand commands need to store
- // meta information about updates.
- UpdateProgress* GetUnrestrictedUpdateProgress(ModelSafeGroup group) {
- return &GetOrCreateModelSafeGroupState(false, group)->update_progress;
- }
+ // 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;
+ const UpdateProgress* GetUnrestrictedUpdateProgress(
+ ModelSafeGroup group) const;
// ClientToServer messages.
const ClientToServerMessage& commit_message() {
@@ -129,10 +119,14 @@ class StatusController {
DCHECK(CurrentCommitIdProjectionHasIndex(index));
return shared_.commit_set.GetCommitIdAt(index);
}
- syncable::ModelType GetCommitIdModelTypeAt(size_t index) {
+ syncable::ModelType GetCommitModelTypeAt(size_t index) {
DCHECK(CurrentCommitIdProjectionHasIndex(index));
return shared_.commit_set.GetModelTypeAt(index);
}
+ syncable::ModelType GetUnrestrictedCommitModelTypeAt(size_t index) const {
+ DCHECK(!group_restriction_in_effect_) << "Group restriction in effect!";
+ return shared_.commit_set.GetModelTypeAt(index);
+ }
const std::vector<int64>& unsynced_handles() const {
DCHECK(!group_restriction_in_effect_)
<< "unsynced_handles is unrestricted.";
@@ -241,7 +235,7 @@ class StatusController {
void set_debug_info_sent();
- bool debug_info_sent();
+ bool debug_info_sent() const;
private:
friend class ScopedModelSafeGroupRestriction;
@@ -250,9 +244,13 @@ class StatusController {
// references position |index| into the full set of commit ids in play.
bool CurrentCommitIdProjectionHasIndex(size_t index);
+ // 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);
+ PerModelSafeGroupState* GetOrCreateModelSafeGroupState(
+ bool restrict, ModelSafeGroup group);
AllModelTypeState shared_;
std::map<ModelSafeGroup, PerModelSafeGroupState*> per_model_group_;
« no previous file with comments | « chrome/browser/sync/sessions/session_state.cc ('k') | chrome/browser/sync/sessions/status_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698