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