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

Side by Side Diff: sync/sessions/session_state.h

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/ordered_commit_set_unittest.cc ('k') | sync/sessions/session_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
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
133 std::string ToString() const; 130 std::string ToString() const;
134 131
135 SyncerStatus syncer_status() const; 132 SyncerStatus syncer_status() const;
136 ErrorCounters errors() const; 133 ErrorCounters errors() const;
137 int64 num_server_changes_remaining() const; 134 int64 num_server_changes_remaining() const;
138 bool is_share_usable() const; 135 bool is_share_usable() const;
139 syncable::ModelTypeSet initial_sync_ended() const; 136 syncable::ModelTypeSet initial_sync_ended() const;
140 syncable::ModelTypePayloadMap download_progress_markers() const; 137 syncable::ModelTypePayloadMap download_progress_markers() const;
141 bool has_more_to_sync() const; 138 bool has_more_to_sync() const;
142 bool is_silenced() const; 139 bool is_silenced() const;
143 int64 unsynced_count() const;
144 int num_encryption_conflicts() const; 140 int num_encryption_conflicts() const;
145 int num_hierarchy_conflicts() const; 141 int num_hierarchy_conflicts() const;
146 int num_simple_conflicts() const; 142 int num_simple_conflicts() const;
147 int num_server_conflicts() const; 143 int num_server_conflicts() const;
148 bool did_commit_items() const; 144 bool did_commit_items() const;
149 SyncSourceInfo source() const; 145 SyncSourceInfo source() const;
150 bool notifications_enabled() const; 146 bool notifications_enabled() const;
151 size_t num_entries() const; 147 size_t num_entries() const;
152 base::Time sync_start_time() const; 148 base::Time sync_start_time() const;
153 bool retry_scheduled() const; 149 bool retry_scheduled() const;
154 150
155 private: 151 private:
156 SyncerStatus syncer_status_; 152 SyncerStatus syncer_status_;
157 ErrorCounters errors_; 153 ErrorCounters errors_;
158 int64 num_server_changes_remaining_; 154 int64 num_server_changes_remaining_;
159 bool is_share_usable_; 155 bool is_share_usable_;
160 syncable::ModelTypeSet initial_sync_ended_; 156 syncable::ModelTypeSet initial_sync_ended_;
161 syncable::ModelTypePayloadMap download_progress_markers_; 157 syncable::ModelTypePayloadMap download_progress_markers_;
162 bool has_more_to_sync_; 158 bool has_more_to_sync_;
163 bool is_silenced_; 159 bool is_silenced_;
164 int64 unsynced_count_;
165 int num_encryption_conflicts_; 160 int num_encryption_conflicts_;
166 int num_hierarchy_conflicts_; 161 int num_hierarchy_conflicts_;
167 int num_simple_conflicts_; 162 int num_simple_conflicts_;
168 int num_server_conflicts_; 163 int num_server_conflicts_;
169 bool did_commit_items_;
170 SyncSourceInfo source_; 164 SyncSourceInfo source_;
171 bool notifications_enabled_; 165 bool notifications_enabled_;
172 size_t num_entries_; 166 size_t num_entries_;
173 base::Time sync_start_time_; 167 base::Time sync_start_time_;
174 bool retry_scheduled_; 168 bool retry_scheduled_;
175 }; 169 };
176 170
177 // Tracks progress of conflicts and their resolutions. 171 // Tracks progress of conflicts and their resolutions.
178 class ConflictProgress { 172 class ConflictProgress {
179 public: 173 public:
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // of state are dirty-on-write and should incur dirty bit updates if changed. 308 // of state are dirty-on-write and should incur dirty bit updates if changed.
315 309
316 // Grouping of all state that applies to all model types. Note that some 310 // Grouping of all state that applies to all model types. Note that some
317 // components of the global grouping can internally implement finer grained 311 // components of the global grouping can internally implement finer grained
318 // scope control (such as OrderedCommitSet), but the top level entity is still 312 // scope control (such as OrderedCommitSet), but the top level entity is still
319 // a singleton with respect to model types. 313 // a singleton with respect to model types.
320 struct AllModelTypeState { 314 struct AllModelTypeState {
321 explicit AllModelTypeState(bool* dirty_flag); 315 explicit AllModelTypeState(bool* dirty_flag);
322 ~AllModelTypeState(); 316 ~AllModelTypeState();
323 317
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. 318 // We GetUpdates for some combination of types at once.
328 // requested_update_types stores the set of types which were requested. 319 // requested_update_types stores the set of types which were requested.
329 syncable::ModelTypeSet updates_request_types; 320 syncable::ModelTypeSet updates_request_types;
330 ClientToServerResponse updates_response; 321 ClientToServerResponse updates_response;
331 // Used to build the shared commit message. 322 // Used to build the shared commit message.
332 DirtyOnWrite<std::vector<int64> > unsynced_handles;
333 DirtyOnWrite<SyncerStatus> syncer_status; 323 DirtyOnWrite<SyncerStatus> syncer_status;
334 DirtyOnWrite<ErrorCounters> error; 324 DirtyOnWrite<ErrorCounters> error;
335 SyncCycleControlParameters control_params; 325 SyncCycleControlParameters control_params;
336 DirtyOnWrite<int64> num_server_changes_remaining; 326 DirtyOnWrite<int64> num_server_changes_remaining;
337 OrderedCommitSet commit_set;
338 }; 327 };
339 328
340 // Grouping of all state that applies to a single ModelSafeGroup. 329 // Grouping of all state that applies to a single ModelSafeGroup.
341 struct PerModelSafeGroupState { 330 struct PerModelSafeGroupState {
342 explicit PerModelSafeGroupState(bool* dirty_flag); 331 explicit PerModelSafeGroupState(bool* dirty_flag);
343 ~PerModelSafeGroupState(); 332 ~PerModelSafeGroupState();
344 333
345 UpdateProgress update_progress; 334 UpdateProgress update_progress;
346 ConflictProgress conflict_progress; 335 ConflictProgress conflict_progress;
347 }; 336 };
348 337
349 } // namespace sessions 338 } // namespace sessions
350 } // namespace browser_sync 339 } // namespace browser_sync
351 340
352 #endif // SYNC_SESSIONS_SESSION_STATE_H_ 341 #endif // SYNC_SESSIONS_SESSION_STATE_H_
OLDNEW
« no previous file with comments | « sync/sessions/ordered_commit_set_unittest.cc ('k') | sync/sessions/session_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698