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

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

Issue 10038041: sync: Loop committing items without downloading updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::string 113 const std::string
115 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], 114 (&download_progress_markers)[syncable::MODEL_TYPE_COUNT],
116 bool more_to_sync, 115 bool more_to_sync,
117 bool is_silenced, 116 bool is_silenced,
118 int64 unsynced_count,
119 int num_encryption_conflicts, 117 int num_encryption_conflicts,
120 int num_hierarchy_conflicts, 118 int num_hierarchy_conflicts,
121 int num_simple_conflicts, 119 int num_simple_conflicts,
122 int num_server_conflicts, 120 int num_server_conflicts,
123 bool did_commit_items,
124 const SyncSourceInfo& source, 121 const SyncSourceInfo& source,
125 bool notifications_enabled, 122 bool notifications_enabled,
126 size_t num_entries, 123 size_t num_entries,
127 base::Time sync_start_time, 124 base::Time sync_start_time,
128 bool retry_scheduled); 125 bool retry_scheduled);
129 ~SyncSessionSnapshot(); 126 ~SyncSessionSnapshot();
130 127
131 // Caller takes ownership of the returned dictionary. 128 // Caller takes ownership of the returned dictionary.
132 base::DictionaryValue* ToValue() const; 129 base::DictionaryValue* ToValue() const;
133 130
134 std::string ToString() const; 131 std::string ToString() const;
135 132
136 const SyncerStatus syncer_status; 133 const SyncerStatus syncer_status;
137 const ErrorCounters errors; 134 const ErrorCounters errors;
138 const int64 num_server_changes_remaining; 135 const int64 num_server_changes_remaining;
139 const bool is_share_usable; 136 const bool is_share_usable;
140 const syncable::ModelTypeSet initial_sync_ended; 137 const syncable::ModelTypeSet initial_sync_ended;
141 const std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; 138 const std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
142 const bool has_more_to_sync; 139 const bool has_more_to_sync;
143 const bool is_silenced; 140 const bool is_silenced;
144 const int64 unsynced_count;
145 const int num_encryption_conflicts; 141 const int num_encryption_conflicts;
146 const int num_hierarchy_conflicts; 142 const int num_hierarchy_conflicts;
147 const int num_simple_conflicts; 143 const int num_simple_conflicts;
148 const int num_server_conflicts; 144 const int num_server_conflicts;
149 const bool did_commit_items;
150 const SyncSourceInfo source; 145 const SyncSourceInfo source;
151 const bool notifications_enabled; 146 const bool notifications_enabled;
152 const size_t num_entries; 147 const size_t num_entries;
153 base::Time sync_start_time; 148 base::Time sync_start_time;
154 const bool retry_scheduled; 149 const bool retry_scheduled;
155 }; 150 };
156 151
157 // Tracks progress of conflicts and their resolutions. 152 // Tracks progress of conflicts and their resolutions.
158 class ConflictProgress { 153 class ConflictProgress {
159 public: 154 public:
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // of state are dirty-on-write and should incur dirty bit updates if changed. 289 // of state are dirty-on-write and should incur dirty bit updates if changed.
295 290
296 // Grouping of all state that applies to all model types. Note that some 291 // Grouping of all state that applies to all model types. Note that some
297 // components of the global grouping can internally implement finer grained 292 // components of the global grouping can internally implement finer grained
298 // scope control (such as OrderedCommitSet), but the top level entity is still 293 // scope control (such as OrderedCommitSet), but the top level entity is still
299 // a singleton with respect to model types. 294 // a singleton with respect to model types.
300 struct AllModelTypeState { 295 struct AllModelTypeState {
301 explicit AllModelTypeState(bool* dirty_flag); 296 explicit AllModelTypeState(bool* dirty_flag);
302 ~AllModelTypeState(); 297 ~AllModelTypeState();
303 298
304 // Commits for all model types are bundled together into a single message.
305 ClientToServerMessage commit_message;
306 ClientToServerResponse commit_response;
307 // We GetUpdates for some combination of types at once. 299 // We GetUpdates for some combination of types at once.
308 // requested_update_types stores the set of types which were requested. 300 // requested_update_types stores the set of types which were requested.
309 syncable::ModelTypeSet updates_request_types; 301 syncable::ModelTypeSet updates_request_types;
310 ClientToServerResponse updates_response; 302 ClientToServerResponse updates_response;
311 // Used to build the shared commit message. 303 // Used to build the shared commit message.
312 DirtyOnWrite<std::vector<int64> > unsynced_handles;
313 DirtyOnWrite<SyncerStatus> syncer_status; 304 DirtyOnWrite<SyncerStatus> syncer_status;
314 DirtyOnWrite<ErrorCounters> error; 305 DirtyOnWrite<ErrorCounters> error;
315 SyncCycleControlParameters control_params; 306 SyncCycleControlParameters control_params;
316 DirtyOnWrite<int64> num_server_changes_remaining; 307 DirtyOnWrite<int64> num_server_changes_remaining;
317 OrderedCommitSet commit_set;
318 }; 308 };
319 309
320 // Grouping of all state that applies to a single ModelSafeGroup. 310 // Grouping of all state that applies to a single ModelSafeGroup.
321 struct PerModelSafeGroupState { 311 struct PerModelSafeGroupState {
322 explicit PerModelSafeGroupState(bool* dirty_flag); 312 explicit PerModelSafeGroupState(bool* dirty_flag);
323 ~PerModelSafeGroupState(); 313 ~PerModelSafeGroupState();
324 314
325 UpdateProgress update_progress; 315 UpdateProgress update_progress;
326 ConflictProgress conflict_progress; 316 ConflictProgress conflict_progress;
327 }; 317 };
328 318
329 } // namespace sessions 319 } // namespace sessions
330 } // namespace browser_sync 320 } // namespace browser_sync
331 321
332 #endif // SYNC_SESSIONS_SESSION_STATE_H_ 322 #endif // SYNC_SESSIONS_SESSION_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698