OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 5 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
6 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 6 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Tracks that a local refresh request has been made for this type. | 37 // Tracks that a local refresh request has been made for this type. |
38 void RecordLocalRefreshRequest(); | 38 void RecordLocalRefreshRequest(); |
39 | 39 |
40 // Tracks that we received invalidation notifications for this type. | 40 // Tracks that we received invalidation notifications for this type. |
41 void RecordRemoteInvalidation(scoped_ptr<InvalidationInterface> incoming); | 41 void RecordRemoteInvalidation(scoped_ptr<InvalidationInterface> incoming); |
42 | 42 |
43 // Takes note that initial sync is pending for this type. | 43 // Takes note that initial sync is pending for this type. |
44 void RecordInitialSyncRequired(); | 44 void RecordInitialSyncRequired(); |
45 | 45 |
46 // Takes note that the conflict happended for this type, need to sync to | |
47 // resolve conflict locally. | |
48 void RecordCommitConflict(); | |
49 | |
50 // Records that a sync cycle has been performed successfully. | 46 // Records that a sync cycle has been performed successfully. |
51 // Generally, this means that all local changes have been committed and all | 47 // Generally, this means that all local changes have been committed and all |
52 // remote changes have been downloaded, so we can clear any flags related to | 48 // remote changes have been downloaded, so we can clear any flags related to |
53 // pending work. | 49 // pending work. |
54 void RecordSuccessfulSyncCycle(); | 50 void RecordSuccessfulSyncCycle(); |
55 | 51 |
56 // Updates the size of the invalidations payload buffer. | 52 // Updates the size of the invalidations payload buffer. |
57 void UpdatePayloadBufferSize(size_t new_size); | 53 void UpdatePayloadBufferSize(size_t new_size); |
58 | 54 |
59 // Returns true if there is a good reason to perform a sync cycle. This does | 55 // Returns true if there is a good reason to perform a sync cycle. This does |
(...skipping 11 matching lines...) Expand all Loading... |
71 // Returns true if we've received an invalidation since we last fetched | 67 // Returns true if we've received an invalidation since we last fetched |
72 // updates. | 68 // updates. |
73 bool HasPendingInvalidation() const; | 69 bool HasPendingInvalidation() const; |
74 | 70 |
75 // Returns true if an explicit refresh request is still outstanding. | 71 // Returns true if an explicit refresh request is still outstanding. |
76 bool HasRefreshRequestPending() const; | 72 bool HasRefreshRequestPending() const; |
77 | 73 |
78 // Returns true if this type is requesting an initial sync. | 74 // Returns true if this type is requesting an initial sync. |
79 bool IsInitialSyncRequired() const; | 75 bool IsInitialSyncRequired() const; |
80 | 76 |
81 // Returns true if this type is requesting a sync to resolve conflict issue. | |
82 bool IsSyncRequiredToResolveConflict() const; | |
83 | |
84 // Fills in the legacy invalidaiton payload information fields. | 77 // Fills in the legacy invalidaiton payload information fields. |
85 void SetLegacyNotificationHint( | 78 void SetLegacyNotificationHint( |
86 sync_pb::DataTypeProgressMarker* progress) const; | 79 sync_pb::DataTypeProgressMarker* progress) const; |
87 | 80 |
88 // Fills some type-specific contents of a GetUpdates request protobuf. These | 81 // Fills some type-specific contents of a GetUpdates request protobuf. These |
89 // messages provide the server with the information it needs to decide how to | 82 // messages provide the server with the information it needs to decide how to |
90 // handle a request. | 83 // handle a request. |
91 void FillGetUpdatesTriggersMessage(sync_pb::GetUpdateTriggers* msg) const; | 84 void FillGetUpdatesTriggersMessage(sync_pb::GetUpdateTriggers* msg) const; |
92 | 85 |
93 // Returns true if the type is currently throttled. | 86 // Returns true if the type is currently throttled. |
(...skipping 28 matching lines...) Expand all Loading... |
122 // | 115 // |
123 // This list takes ownership of its contents. | 116 // This list takes ownership of its contents. |
124 ScopedVector<InvalidationInterface> pending_invalidations_; | 117 ScopedVector<InvalidationInterface> pending_invalidations_; |
125 | 118 |
126 size_t payload_buffer_size_; | 119 size_t payload_buffer_size_; |
127 | 120 |
128 // Set to true if this type is ready for, but has not yet completed initial | 121 // Set to true if this type is ready for, but has not yet completed initial |
129 // sync. | 122 // sync. |
130 bool initial_sync_required_; | 123 bool initial_sync_required_; |
131 | 124 |
132 // Set to true if this type need to get update to resolve conflict issue. | |
133 bool sync_required_to_resolve_conflict_; | |
134 | |
135 // If !unthrottle_time_.is_null(), this type is throttled and may not download | 125 // If !unthrottle_time_.is_null(), this type is throttled and may not download |
136 // or commit data until the specified time. | 126 // or commit data until the specified time. |
137 base::TimeTicks unthrottle_time_; | 127 base::TimeTicks unthrottle_time_; |
138 | 128 |
139 // A helper to keep track invalidations we dropped due to overflow. | 129 // A helper to keep track invalidations we dropped due to overflow. |
140 scoped_ptr<InvalidationInterface> last_dropped_invalidation_; | 130 scoped_ptr<InvalidationInterface> last_dropped_invalidation_; |
141 | 131 |
142 // The amount of time to delay a sync cycle by when a local change for this | 132 // The amount of time to delay a sync cycle by when a local change for this |
143 // type occurs. | 133 // type occurs. |
144 base::TimeDelta nudge_delay_; | 134 base::TimeDelta nudge_delay_; |
145 | 135 |
146 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker); | 136 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker); |
147 }; | 137 }; |
148 | 138 |
149 } // namespace sessions | 139 } // namespace sessions |
150 } // namespace syncer | 140 } // namespace syncer |
151 | 141 |
152 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 142 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
OLD | NEW |