Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // The 'sessions' namespace comprises all the pieces of state that are | 5 // The 'sessions' namespace comprises all the pieces of state that are |
| 6 // combined to form a SyncSession instance. In that way, it can be thought of | 6 // combined to form a SyncSession instance. In that way, it can be thought of |
| 7 // as an extension of the SyncSession type itself. Session scoping gives | 7 // as an extension of the SyncSession type itself. Session scoping gives |
| 8 // context to things like "conflict progress", "update progress", etc, and the | 8 // context to things like "conflict progress", "update progress", etc, and the |
| 9 // separation this file provides allows clients to only include the parts they | 9 // separation this file provides allows clients to only include the parts they |
| 10 // need rather than the entire session stack. | 10 // need rather than the entire session stack. |
| 11 | 11 |
| 12 #ifndef SYNC_SESSIONS_SESSION_STATE_H_ | 12 #ifndef SYNC_SESSIONS_SESSION_STATE_H_ |
| 13 #define SYNC_SESSIONS_SESSION_STATE_H_ | 13 #define SYNC_SESSIONS_SESSION_STATE_H_ |
| 14 #pragma once | 14 #pragma once |
| 15 | 15 |
| 16 #include <map> | 16 #include <map> |
| 17 #include <set> | 17 #include <set> |
| 18 #include <string> | 18 #include <string> |
| 19 #include <utility> | 19 #include <utility> |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 23 #include "sync/engine/syncer_types.h" | 23 #include "sync/engine/syncer_types.h" |
| 24 #include "sync/engine/syncproto.h" | 24 #include "sync/engine/syncproto.h" |
| 25 #include "sync/protocol/sync_protocol_error.h" | 25 #include "sync/protocol/sync_protocol_error.h" |
| 26 #include "sync/sessions/ordered_commit_set.h" | |
| 27 #include "sync/syncable/model_type.h" | 26 #include "sync/syncable/model_type.h" |
| 28 #include "sync/syncable/model_type_payload_map.h" | 27 #include "sync/syncable/model_type_payload_map.h" |
| 29 #include "sync/syncable/syncable.h" | 28 #include "sync/syncable/syncable.h" |
| 30 | 29 |
| 31 namespace base { | 30 namespace base { |
| 32 class DictionaryValue; | 31 class DictionaryValue; |
| 33 } | 32 } |
| 34 | 33 |
| 35 namespace browser_sync { | 34 namespace browser_sync { |
| 36 namespace sessions { | 35 namespace sessions { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 SyncSessionSnapshot(); | 106 SyncSessionSnapshot(); |
| 108 SyncSessionSnapshot( | 107 SyncSessionSnapshot( |
| 109 const SyncerStatus& syncer_status, | 108 const SyncerStatus& syncer_status, |
| 110 const ErrorCounters& errors, | 109 const ErrorCounters& errors, |
| 111 int64 num_server_changes_remaining, | 110 int64 num_server_changes_remaining, |
| 112 bool is_share_usable, | 111 bool is_share_usable, |
| 113 syncable::ModelTypeSet initial_sync_ended, | 112 syncable::ModelTypeSet initial_sync_ended, |
| 114 const syncable::ModelTypePayloadMap& download_progress_markers, | 113 const syncable::ModelTypePayloadMap& download_progress_markers, |
| 115 bool more_to_sync, | 114 bool more_to_sync, |
| 116 bool is_silenced, | 115 bool is_silenced, |
| 117 int64 unsynced_count, | |
| 118 int num_encryption_conflicts, | 116 int num_encryption_conflicts, |
| 119 int num_hierarchy_conflicts, | 117 int num_hierarchy_conflicts, |
| 120 int num_simple_conflicts, | 118 int num_simple_conflicts, |
| 121 int num_server_conflicts, | 119 int num_server_conflicts, |
| 122 bool did_commit_items, | |
|
tim (not reviewing)
2012/05/11 18:42:16
Where is this captured, again?
rlarocque
2012/05/14 23:10:43
It was based on control_params.items_comitted, whi
| |
| 123 const SyncSourceInfo& source, | 120 const SyncSourceInfo& source, |
| 124 bool notifications_enabled, | 121 bool notifications_enabled, |
| 125 size_t num_entries, | 122 size_t num_entries, |
| 126 base::Time sync_start_time, | 123 base::Time sync_start_time, |
| 127 bool retry_scheduled); | 124 bool retry_scheduled); |
| 128 ~SyncSessionSnapshot(); | 125 ~SyncSessionSnapshot(); |
| 129 | 126 |
| 130 // Caller takes ownership of the returned dictionary. | 127 // Caller takes ownership of the returned dictionary. |
| 131 base::DictionaryValue* ToValue() const; | 128 base::DictionaryValue* ToValue() const; |
| 132 | 129 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 154 | 151 |
| 155 private: | 152 private: |
| 156 SyncerStatus syncer_status_; | 153 SyncerStatus syncer_status_; |
| 157 ErrorCounters errors_; | 154 ErrorCounters errors_; |
| 158 int64 num_server_changes_remaining_; | 155 int64 num_server_changes_remaining_; |
| 159 bool is_share_usable_; | 156 bool is_share_usable_; |
| 160 syncable::ModelTypeSet initial_sync_ended_; | 157 syncable::ModelTypeSet initial_sync_ended_; |
| 161 syncable::ModelTypePayloadMap download_progress_markers_; | 158 syncable::ModelTypePayloadMap download_progress_markers_; |
| 162 bool has_more_to_sync_; | 159 bool has_more_to_sync_; |
| 163 bool is_silenced_; | 160 bool is_silenced_; |
| 164 int64 unsynced_count_; | 161 int64 unsynced_count_; |
|
tim (not reviewing)
2012/05/11 18:42:16
You left this here, but removed it everywhere else
rlarocque
2012/05/14 23:10:43
Oops. I meant to remove it here, too.
This CL le
tim (not reviewing)
2012/05/15 22:25:00
OK. Can you make sure there are bugs documenting
| |
| 165 int num_encryption_conflicts_; | 162 int num_encryption_conflicts_; |
| 166 int num_hierarchy_conflicts_; | 163 int num_hierarchy_conflicts_; |
| 167 int num_simple_conflicts_; | 164 int num_simple_conflicts_; |
| 168 int num_server_conflicts_; | 165 int num_server_conflicts_; |
| 169 bool did_commit_items_; | |
| 170 SyncSourceInfo source_; | 166 SyncSourceInfo source_; |
| 171 bool notifications_enabled_; | 167 bool notifications_enabled_; |
| 172 size_t num_entries_; | 168 size_t num_entries_; |
| 173 base::Time sync_start_time_; | 169 base::Time sync_start_time_; |
| 174 bool retry_scheduled_; | 170 bool retry_scheduled_; |
| 175 }; | 171 }; |
| 176 | 172 |
| 177 // Tracks progress of conflicts and their resolutions. | 173 // Tracks progress of conflicts and their resolutions. |
| 178 class ConflictProgress { | 174 class ConflictProgress { |
| 179 public: | 175 public: |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 // of state are dirty-on-write and should incur dirty bit updates if changed. | 310 // of state are dirty-on-write and should incur dirty bit updates if changed. |
| 315 | 311 |
| 316 // Grouping of all state that applies to all model types. Note that some | 312 // Grouping of all state that applies to all model types. Note that some |
| 317 // components of the global grouping can internally implement finer grained | 313 // components of the global grouping can internally implement finer grained |
| 318 // scope control (such as OrderedCommitSet), but the top level entity is still | 314 // scope control (such as OrderedCommitSet), but the top level entity is still |
| 319 // a singleton with respect to model types. | 315 // a singleton with respect to model types. |
| 320 struct AllModelTypeState { | 316 struct AllModelTypeState { |
| 321 explicit AllModelTypeState(bool* dirty_flag); | 317 explicit AllModelTypeState(bool* dirty_flag); |
| 322 ~AllModelTypeState(); | 318 ~AllModelTypeState(); |
| 323 | 319 |
| 324 // Commits for all model types are bundled together into a single message. | |
| 325 ClientToServerMessage commit_message; | |
| 326 ClientToServerResponse commit_response; | |
| 327 // We GetUpdates for some combination of types at once. | 320 // We GetUpdates for some combination of types at once. |
| 328 // requested_update_types stores the set of types which were requested. | 321 // requested_update_types stores the set of types which were requested. |
| 329 syncable::ModelTypeSet updates_request_types; | 322 syncable::ModelTypeSet updates_request_types; |
| 330 ClientToServerResponse updates_response; | 323 ClientToServerResponse updates_response; |
| 331 // Used to build the shared commit message. | 324 // Used to build the shared commit message. |
| 332 DirtyOnWrite<std::vector<int64> > unsynced_handles; | |
| 333 DirtyOnWrite<SyncerStatus> syncer_status; | 325 DirtyOnWrite<SyncerStatus> syncer_status; |
| 334 DirtyOnWrite<ErrorCounters> error; | 326 DirtyOnWrite<ErrorCounters> error; |
| 335 SyncCycleControlParameters control_params; | 327 SyncCycleControlParameters control_params; |
| 336 DirtyOnWrite<int64> num_server_changes_remaining; | 328 DirtyOnWrite<int64> num_server_changes_remaining; |
| 337 OrderedCommitSet commit_set; | |
| 338 }; | 329 }; |
| 339 | 330 |
| 340 // Grouping of all state that applies to a single ModelSafeGroup. | 331 // Grouping of all state that applies to a single ModelSafeGroup. |
| 341 struct PerModelSafeGroupState { | 332 struct PerModelSafeGroupState { |
| 342 explicit PerModelSafeGroupState(bool* dirty_flag); | 333 explicit PerModelSafeGroupState(bool* dirty_flag); |
| 343 ~PerModelSafeGroupState(); | 334 ~PerModelSafeGroupState(); |
| 344 | 335 |
| 345 UpdateProgress update_progress; | 336 UpdateProgress update_progress; |
| 346 ConflictProgress conflict_progress; | 337 ConflictProgress conflict_progress; |
| 347 }; | 338 }; |
| 348 | 339 |
| 349 } // namespace sessions | 340 } // namespace sessions |
| 350 } // namespace browser_sync | 341 } // namespace browser_sync |
| 351 | 342 |
| 352 #endif // SYNC_SESSIONS_SESSION_STATE_H_ | 343 #endif // SYNC_SESSIONS_SESSION_STATE_H_ |
| OLD | NEW |