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 outstanding work required to bring the client back into | 5 // A class to track the outstanding work required to bring the client back into |
6 // sync with the server. | 6 // sync with the server. |
7 #ifndef SYNC_SESSIONS_NUDGE_TRACKER_H_ | 7 #ifndef SYNC_SESSIONS_NUDGE_TRACKER_H_ |
8 #define SYNC_SESSIONS_NUDGE_TRACKER_H_ | 8 #define SYNC_SESSIONS_NUDGE_TRACKER_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" |
14 #include "sync/base/sync_export.h" | 15 #include "sync/base/sync_export.h" |
15 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
16 #include "sync/protocol/sync.pb.h" | 17 #include "sync/protocol/sync.pb.h" |
17 #include "sync/sessions/data_type_tracker.h" | 18 #include "sync/sessions/data_type_tracker.h" |
18 | 19 |
19 namespace syncer { | 20 namespace syncer { |
20 | 21 |
21 class ObjectIdInvalidationMap; | 22 class ObjectIdInvalidationMap; |
22 | 23 |
23 namespace sessions { | 24 namespace sessions { |
(...skipping 26 matching lines...) Expand all Loading... |
50 // completed successfully. | 51 // completed successfully. |
51 void RecordSuccessfulSyncCycle(); | 52 void RecordSuccessfulSyncCycle(); |
52 | 53 |
53 // Takes note of a local change. | 54 // Takes note of a local change. |
54 void RecordLocalChange(ModelTypeSet types); | 55 void RecordLocalChange(ModelTypeSet types); |
55 | 56 |
56 // Takes note of a locally issued request to refresh a data type. | 57 // Takes note of a locally issued request to refresh a data type. |
57 void RecordLocalRefreshRequest(ModelTypeSet types); | 58 void RecordLocalRefreshRequest(ModelTypeSet types); |
58 | 59 |
59 // Takes note of the receipt of an invalidation notice from the server. | 60 // Takes note of the receipt of an invalidation notice from the server. |
60 void RecordRemoteInvalidation( | 61 void RecordRemoteInvalidation(syncer::ModelType type, |
61 const ObjectIdInvalidationMap& invalidation_map); | 62 scoped_ptr<InvalidationInterface> invalidation); |
62 | 63 |
63 // These functions should be called to keep this class informed of the status | 64 // These functions should be called to keep this class informed of the status |
64 // of the connection to the invalidations server. | 65 // of the connection to the invalidations server. |
65 void OnInvalidationsEnabled(); | 66 void OnInvalidationsEnabled(); |
66 void OnInvalidationsDisabled(); | 67 void OnInvalidationsDisabled(); |
67 | 68 |
68 // Marks |types| as being throttled from |now| until |now| + |length|. | 69 // Marks |types| as being throttled from |now| until |now| + |length|. |
69 void SetTypesThrottledUntil(ModelTypeSet types, | 70 void SetTypesThrottledUntil(ModelTypeSet types, |
70 base::TimeDelta length, | 71 base::TimeDelta length, |
71 base::TimeTicks now); | 72 base::TimeTicks now); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // This is a request sent to us as part of a server response requesting | 131 // This is a request sent to us as part of a server response requesting |
131 // that the client perform a GetUpdate request at |next_retry_time| to | 132 // that the client perform a GetUpdate request at |next_retry_time| to |
132 // fetch any updates it may have missed in the first attempt. | 133 // fetch any updates it may have missed in the first attempt. |
133 // | 134 // |
134 // To avoid strange results from IsRetryRequired() during a sync cycle, the | 135 // To avoid strange results from IsRetryRequired() during a sync cycle, the |
135 // effects of this change are not guaranteed to take effect until | 136 // effects of this change are not guaranteed to take effect until |
136 // SetSyncCycleStartTime() is called at the start of the *next* sync cycle. | 137 // SetSyncCycleStartTime() is called at the start of the *next* sync cycle. |
137 void SetNextRetryTime(base::TimeTicks next_retry_time); | 138 void SetNextRetryTime(base::TimeTicks next_retry_time); |
138 | 139 |
139 private: | 140 private: |
140 typedef std::map<ModelType, DataTypeTracker> TypeTrackerMap; | 141 typedef std::map<ModelType, DataTypeTracker*> TypeTrackerMap; |
141 | 142 |
142 TypeTrackerMap type_trackers_; | 143 TypeTrackerMap type_trackers_; |
| 144 STLValueDeleter<TypeTrackerMap> type_tracker_deleter_; |
143 | 145 |
144 // Merged updates source. This should be obsolete, but the server still | 146 // Merged updates source. This should be obsolete, but the server still |
145 // relies on it for some heuristics. | 147 // relies on it for some heuristics. |
146 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source_; | 148 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source_; |
147 | 149 |
148 // Tracks whether or not invalidations are currently enabled. | 150 // Tracks whether or not invalidations are currently enabled. |
149 bool invalidations_enabled_; | 151 bool invalidations_enabled_; |
150 | 152 |
151 // This flag is set if suspect that some technical malfunction or known bug | 153 // This flag is set if suspect that some technical malfunction or known bug |
152 // may have left us with some unserviced invalidations. | 154 // may have left us with some unserviced invalidations. |
(...skipping 27 matching lines...) Expand all Loading... |
180 // currently in a sync cycle. | 182 // currently in a sync cycle. |
181 base::TimeTicks sync_cycle_start_time_; | 183 base::TimeTicks sync_cycle_start_time_; |
182 | 184 |
183 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); | 185 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
184 }; | 186 }; |
185 | 187 |
186 } // namespace sessions | 188 } // namespace sessions |
187 } // namespace syncer | 189 } // namespace syncer |
188 | 190 |
189 #endif // SYNC_SESSIONS_NUDGE_TRACKER_H_ | 191 #endif // SYNC_SESSIONS_NUDGE_TRACKER_H_ |
OLD | NEW |