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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "sync/internal_api/public/base/invalidation_interface.h" | 16 #include "sync/internal_api/public/base/invalidation_interface.h" |
17 #include "sync/internal_api/public/base/model_type.h" | 17 #include "sync/internal_api/public/base/model_type.h" |
18 #include "sync/protocol/sync.pb.h" | 18 #include "sync/protocol/sync.pb.h" |
19 | 19 |
20 namespace syncer { | 20 namespace syncer { |
21 | 21 |
22 class InvalidationInterface; | 22 class InvalidationInterface; |
23 | 23 |
24 namespace sessions { | 24 namespace sessions { |
25 | 25 |
26 // A class to track the per-type scheduling data. | 26 // A class to track the per-type scheduling data. |
27 class DataTypeTracker { | 27 class DataTypeTracker { |
28 public: | 28 public: |
29 DataTypeTracker(); | 29 DataTypeTracker(); |
30 ~DataTypeTracker(); | 30 ~DataTypeTracker(); |
31 | 31 |
32 // For STL compatibility, we do not forbid the creation of a default copy | 32 // For STL compatibility, we do not forbid the creation of a default copy |
33 // constructor and assignment operator. | 33 // constructor and assignment operator. |
34 | 34 |
35 // Tracks that a local change has been made to this type. | 35 // Tracks that a local change has been made to this type. |
36 // Returns the current local change nudge delay for this type. | 36 // Returns the current local change nudge delay for this type. |
37 base::TimeDelta RecordLocalChange(); | 37 base::TimeDelta RecordLocalChange(); |
38 | 38 |
39 // Tracks that a local refresh request has been made for this type. | 39 // Tracks that a local refresh request has been made for this type. |
40 void RecordLocalRefreshRequest(); | 40 void RecordLocalRefreshRequest(); |
41 | 41 |
42 // Tracks that we received invalidation notifications for this type. | 42 // Tracks that we received invalidation notifications for this type. |
43 void RecordRemoteInvalidation(scoped_ptr<InvalidationInterface> incoming); | 43 void RecordRemoteInvalidation( |
| 44 std::unique_ptr<InvalidationInterface> incoming); |
44 | 45 |
45 // Takes note that initial sync is pending for this type. | 46 // Takes note that initial sync is pending for this type. |
46 void RecordInitialSyncRequired(); | 47 void RecordInitialSyncRequired(); |
47 | 48 |
48 // Takes note that the conflict happended for this type, need to sync to | 49 // Takes note that the conflict happended for this type, need to sync to |
49 // resolve conflict locally. | 50 // resolve conflict locally. |
50 void RecordCommitConflict(); | 51 void RecordCommitConflict(); |
51 | 52 |
52 // Records that a sync cycle has been performed successfully. | 53 // Records that a sync cycle has been performed successfully. |
53 // Generally, this means that all local changes have been committed and all | 54 // Generally, this means that all local changes have been committed and all |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 bool initial_sync_required_; | 133 bool initial_sync_required_; |
133 | 134 |
134 // Set to true if this type need to get update to resolve conflict issue. | 135 // Set to true if this type need to get update to resolve conflict issue. |
135 bool sync_required_to_resolve_conflict_; | 136 bool sync_required_to_resolve_conflict_; |
136 | 137 |
137 // If !unthrottle_time_.is_null(), this type is throttled and may not download | 138 // If !unthrottle_time_.is_null(), this type is throttled and may not download |
138 // or commit data until the specified time. | 139 // or commit data until the specified time. |
139 base::TimeTicks unthrottle_time_; | 140 base::TimeTicks unthrottle_time_; |
140 | 141 |
141 // A helper to keep track invalidations we dropped due to overflow. | 142 // A helper to keep track invalidations we dropped due to overflow. |
142 scoped_ptr<InvalidationInterface> last_dropped_invalidation_; | 143 std::unique_ptr<InvalidationInterface> last_dropped_invalidation_; |
143 | 144 |
144 // The amount of time to delay a sync cycle by when a local change for this | 145 // The amount of time to delay a sync cycle by when a local change for this |
145 // type occurs. | 146 // type occurs. |
146 base::TimeDelta nudge_delay_; | 147 base::TimeDelta nudge_delay_; |
147 | 148 |
148 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker); | 149 DISALLOW_COPY_AND_ASSIGN(DataTypeTracker); |
149 }; | 150 }; |
150 | 151 |
151 } // namespace sessions | 152 } // namespace sessions |
152 } // namespace syncer | 153 } // namespace syncer |
153 | 154 |
154 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 155 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
OLD | NEW |