OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 int num_successful_commits; | 71 int num_successful_commits; |
72 // This is needed for monitoring extensions activity. | 72 // This is needed for monitoring extensions activity. |
73 int num_successful_bookmark_commits; | 73 int num_successful_bookmark_commits; |
74 | 74 |
75 // Download event counters. | 75 // Download event counters. |
76 int num_updates_downloaded_total; | 76 int num_updates_downloaded_total; |
77 int num_tombstone_updates_downloaded_total; | 77 int num_tombstone_updates_downloaded_total; |
78 | 78 |
79 // If the syncer encountered a MIGRATION_DONE code, these are the types that | 79 // If the syncer encountered a MIGRATION_DONE code, these are the types that |
80 // the client must now "migrate", by purging and re-downloading all updates. | 80 // the client must now "migrate", by purging and re-downloading all updates. |
81 syncable::ModelEnumSet types_needing_local_migration; | 81 syncable::ModelTypeSet types_needing_local_migration; |
82 | 82 |
83 // Overwrites due to conflict resolution counters. | 83 // Overwrites due to conflict resolution counters. |
84 int num_local_overwrites; | 84 int num_local_overwrites; |
85 int num_server_overwrites; | 85 int num_server_overwrites; |
86 }; | 86 }; |
87 | 87 |
88 // Counters for various errors that can occur repeatedly during a sync session. | 88 // Counters for various errors that can occur repeatedly during a sync session. |
89 // TODO(lipalani) : Rename this structure to Error. | 89 // TODO(lipalani) : Rename this structure to Error. |
90 struct ErrorCounters { | 90 struct ErrorCounters { |
91 ErrorCounters(); | 91 ErrorCounters(); |
(...skipping 22 matching lines...) Expand all Loading... |
114 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]); | 114 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]); |
115 | 115 |
116 // An immutable snapshot of state from a SyncSession. Convenient to use as | 116 // An immutable snapshot of state from a SyncSession. Convenient to use as |
117 // part of notifications as it is inherently thread-safe. | 117 // part of notifications as it is inherently thread-safe. |
118 struct SyncSessionSnapshot { | 118 struct SyncSessionSnapshot { |
119 SyncSessionSnapshot( | 119 SyncSessionSnapshot( |
120 const SyncerStatus& syncer_status, | 120 const SyncerStatus& syncer_status, |
121 const ErrorCounters& errors, | 121 const ErrorCounters& errors, |
122 int64 num_server_changes_remaining, | 122 int64 num_server_changes_remaining, |
123 bool is_share_usable, | 123 bool is_share_usable, |
124 syncable::ModelEnumSet initial_sync_ended, | 124 syncable::ModelTypeSet initial_sync_ended, |
125 const std::string | 125 const std::string |
126 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], | 126 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], |
127 bool more_to_sync, | 127 bool more_to_sync, |
128 bool is_silenced, | 128 bool is_silenced, |
129 int64 unsynced_count, | 129 int64 unsynced_count, |
130 int num_blocking_conflicting_updates, | 130 int num_blocking_conflicting_updates, |
131 int num_conflicting_updates, | 131 int num_conflicting_updates, |
132 bool did_commit_items, | 132 bool did_commit_items, |
133 const SyncSourceInfo& source, | 133 const SyncSourceInfo& source, |
134 size_t num_entries, | 134 size_t num_entries, |
135 base::Time sync_start_time); | 135 base::Time sync_start_time); |
136 ~SyncSessionSnapshot(); | 136 ~SyncSessionSnapshot(); |
137 | 137 |
138 // Caller takes ownership of the returned dictionary. | 138 // Caller takes ownership of the returned dictionary. |
139 base::DictionaryValue* ToValue() const; | 139 base::DictionaryValue* ToValue() const; |
140 | 140 |
141 std::string ToString() const; | 141 std::string ToString() const; |
142 | 142 |
143 const SyncerStatus syncer_status; | 143 const SyncerStatus syncer_status; |
144 const ErrorCounters errors; | 144 const ErrorCounters errors; |
145 const int64 num_server_changes_remaining; | 145 const int64 num_server_changes_remaining; |
146 const bool is_share_usable; | 146 const bool is_share_usable; |
147 const syncable::ModelEnumSet initial_sync_ended; | 147 const syncable::ModelTypeSet initial_sync_ended; |
148 const std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 148 const std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
149 const bool has_more_to_sync; | 149 const bool has_more_to_sync; |
150 const bool is_silenced; | 150 const bool is_silenced; |
151 const int64 unsynced_count; | 151 const int64 unsynced_count; |
152 const int num_blocking_conflicting_updates; | 152 const int num_blocking_conflicting_updates; |
153 const int num_conflicting_updates; | 153 const int num_conflicting_updates; |
154 const bool did_commit_items; | 154 const bool did_commit_items; |
155 const SyncSourceInfo source; | 155 const SyncSourceInfo source; |
156 const size_t num_entries; | 156 const size_t num_entries; |
157 base::Time sync_start_time; | 157 base::Time sync_start_time; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // a singleton with respect to model types. | 312 // a singleton with respect to model types. |
313 struct AllModelTypeState { | 313 struct AllModelTypeState { |
314 explicit AllModelTypeState(bool* dirty_flag); | 314 explicit AllModelTypeState(bool* dirty_flag); |
315 ~AllModelTypeState(); | 315 ~AllModelTypeState(); |
316 | 316 |
317 // Commits for all model types are bundled together into a single message. | 317 // Commits for all model types are bundled together into a single message. |
318 ClientToServerMessage commit_message; | 318 ClientToServerMessage commit_message; |
319 ClientToServerResponse commit_response; | 319 ClientToServerResponse commit_response; |
320 // We GetUpdates for some combination of types at once. | 320 // We GetUpdates for some combination of types at once. |
321 // requested_update_types stores the set of types which were requested. | 321 // requested_update_types stores the set of types which were requested. |
322 syncable::ModelEnumSet updates_request_types; | 322 syncable::ModelTypeSet updates_request_types; |
323 ClientToServerResponse updates_response; | 323 ClientToServerResponse updates_response; |
324 // Used to build the shared commit message. | 324 // Used to build the shared commit message. |
325 DirtyOnWrite<std::vector<int64> > unsynced_handles; | 325 DirtyOnWrite<std::vector<int64> > unsynced_handles; |
326 DirtyOnWrite<SyncerStatus> syncer_status; | 326 DirtyOnWrite<SyncerStatus> syncer_status; |
327 DirtyOnWrite<ErrorCounters> error; | 327 DirtyOnWrite<ErrorCounters> error; |
328 SyncCycleControlParameters control_params; | 328 SyncCycleControlParameters control_params; |
329 DirtyOnWrite<int64> num_server_changes_remaining; | 329 DirtyOnWrite<int64> num_server_changes_remaining; |
330 OrderedCommitSet commit_set; | 330 OrderedCommitSet commit_set; |
331 }; | 331 }; |
332 | 332 |
333 // Grouping of all state that applies to a single ModelSafeGroup. | 333 // Grouping of all state that applies to a single ModelSafeGroup. |
334 struct PerModelSafeGroupState { | 334 struct PerModelSafeGroupState { |
335 explicit PerModelSafeGroupState(bool* dirty_flag); | 335 explicit PerModelSafeGroupState(bool* dirty_flag); |
336 ~PerModelSafeGroupState(); | 336 ~PerModelSafeGroupState(); |
337 | 337 |
338 UpdateProgress update_progress; | 338 UpdateProgress update_progress; |
339 ConflictProgress conflict_progress; | 339 ConflictProgress conflict_progress; |
340 }; | 340 }; |
341 | 341 |
342 } // namespace sessions | 342 } // namespace sessions |
343 } // namespace browser_sync | 343 } // namespace browser_sync |
344 | 344 |
345 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSION_STATE_H_ | 345 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSION_STATE_H_ |
OLD | NEW |