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 // A class to track the per-type scheduling data. | 5 // A class to track the per-type scheduling data. |
6 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 6 #ifndef SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
7 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 7 #define SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "sync/protocol/sync.pb.h" | 14 #include "sync/protocol/sync.pb.h" |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
| 17 |
| 18 class Invalidation; |
| 19 class SingleObjectInvalidationSet; |
| 20 |
17 namespace sessions { | 21 namespace sessions { |
18 | 22 |
19 typedef std::deque<std::string> PayloadList; | 23 typedef std::deque<std::string> PayloadList; |
20 | 24 |
21 class DataTypeTracker { | 25 class DataTypeTracker { |
22 public: | 26 public: |
23 DataTypeTracker(); | 27 DataTypeTracker(); |
24 ~DataTypeTracker(); | 28 ~DataTypeTracker(); |
25 | 29 |
26 // For STL compatibility, we do not forbid the creation of a default copy | 30 // For STL compatibility, we do not forbid the creation of a default copy |
27 // constructor and assignment operator. | 31 // constructor and assignment operator. |
28 | 32 |
29 // Tracks that a local change has been made to this type. | 33 // Tracks that a local change has been made to this type. |
30 void RecordLocalChange(); | 34 void RecordLocalChange(); |
31 | 35 |
32 // Tracks that a local refresh request has been made for this type. | 36 // Tracks that a local refresh request has been made for this type. |
33 void RecordLocalRefreshRequest(); | 37 void RecordLocalRefreshRequest(); |
34 | 38 |
35 // Tracks that we received an invalidation notification for this type. | 39 // Tracks that we received invalidation notifications for this type. |
36 void RecordRemoteInvalidation(const std::string& payload); | 40 void RecordRemoteInvalidations( |
| 41 const SingleObjectInvalidationSet& invalidations); |
37 | 42 |
38 // Records that a sync cycle has been performed successfully. | 43 // Records that a sync cycle has been performed successfully. |
39 // Generally, this means that all local changes have been committed and all | 44 // Generally, this means that all local changes have been committed and all |
40 // remote changes have been downloaded, so we can clear any flags related to | 45 // remote changes have been downloaded, so we can clear any flags related to |
41 // pending work. | 46 // pending work. |
42 void RecordSuccessfulSyncCycle(); | 47 void RecordSuccessfulSyncCycle(); |
43 | 48 |
44 // Updates the size of the invalidations payload buffer. | 49 // Updates the size of the invalidations payload buffer. |
45 void UpdatePayloadBufferSize(size_t new_size); | 50 void UpdatePayloadBufferSize(size_t new_size); |
46 | 51 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 117 |
113 // If !unthrottle_time_.is_null(), this type is throttled and may not download | 118 // If !unthrottle_time_.is_null(), this type is throttled and may not download |
114 // or commit data until the specified time. | 119 // or commit data until the specified time. |
115 base::TimeTicks unthrottle_time_; | 120 base::TimeTicks unthrottle_time_; |
116 }; | 121 }; |
117 | 122 |
118 } // namespace syncer | 123 } // namespace syncer |
119 } // namespace sessions | 124 } // namespace sessions |
120 | 125 |
121 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ | 126 #endif // SYNC_SESSIONS_DATA_TYPE_TRACKER_H_ |
OLD | NEW |