| 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/containers/scoped_ptr_map.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "sync/base/sync_export.h" | 17 #include "sync/base/sync_export.h" |
| 17 #include "sync/internal_api/public/base/invalidation_interface.h" | 18 #include "sync/internal_api/public/base/invalidation_interface.h" |
| 18 #include "sync/internal_api/public/base/model_type.h" | 19 #include "sync/internal_api/public/base/model_type.h" |
| 19 #include "sync/protocol/sync.pb.h" | 20 #include "sync/protocol/sync.pb.h" |
| 20 #include "sync/sessions/data_type_tracker.h" | 21 #include "sync/sessions/data_type_tracker.h" |
| 21 | 22 |
| 22 namespace syncer { | 23 namespace syncer { |
| 23 | 24 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void SetNextRetryTime(base::TimeTicks next_retry_time); | 152 void SetNextRetryTime(base::TimeTicks next_retry_time); |
| 152 | 153 |
| 153 // Update the per-datatype local change nudge delays. | 154 // Update the per-datatype local change nudge delays. |
| 154 void OnReceivedCustomNudgeDelays( | 155 void OnReceivedCustomNudgeDelays( |
| 155 const std::map<ModelType, base::TimeDelta>& delay_map); | 156 const std::map<ModelType, base::TimeDelta>& delay_map); |
| 156 | 157 |
| 157 // Update the default nudge delay. | 158 // Update the default nudge delay. |
| 158 void SetDefaultNudgeDelay(base::TimeDelta nudge_delay); | 159 void SetDefaultNudgeDelay(base::TimeDelta nudge_delay); |
| 159 | 160 |
| 160 private: | 161 private: |
| 161 typedef std::map<ModelType, DataTypeTracker*> TypeTrackerMap; | 162 typedef base::ScopedPtrMap<ModelType, scoped_ptr<DataTypeTracker>> |
| 163 TypeTrackerMap; |
| 162 | 164 |
| 163 TypeTrackerMap type_trackers_; | 165 TypeTrackerMap type_trackers_; |
| 164 STLValueDeleter<TypeTrackerMap> type_tracker_deleter_; | |
| 165 | 166 |
| 166 // Tracks whether or not invalidations are currently enabled. | 167 // Tracks whether or not invalidations are currently enabled. |
| 167 bool invalidations_enabled_; | 168 bool invalidations_enabled_; |
| 168 | 169 |
| 169 // This flag is set if suspect that some technical malfunction or known bug | 170 // This flag is set if suspect that some technical malfunction or known bug |
| 170 // may have left us with some unserviced invalidations. | 171 // may have left us with some unserviced invalidations. |
| 171 // | 172 // |
| 172 // Keeps track of whether or not we're fully in sync with the invalidation | 173 // Keeps track of whether or not we're fully in sync with the invalidation |
| 173 // server. This can be false even if invalidations are enabled and working | 174 // server. This can be false even if invalidations are enabled and working |
| 174 // correctly. For example, until we get ack-tracking working properly, we | 175 // correctly. For example, until we get ack-tracking working properly, we |
| (...skipping 26 matching lines...) Expand all Loading... |
| 201 base::TimeDelta local_refresh_nudge_delay_; | 202 base::TimeDelta local_refresh_nudge_delay_; |
| 202 base::TimeDelta remote_invalidation_nudge_delay_; | 203 base::TimeDelta remote_invalidation_nudge_delay_; |
| 203 | 204 |
| 204 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); | 205 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
| 205 }; | 206 }; |
| 206 | 207 |
| 207 } // namespace sessions | 208 } // namespace sessions |
| 208 } // namespace syncer | 209 } // namespace syncer |
| 209 | 210 |
| 210 #endif // SYNC_SESSIONS_NUDGE_TRACKER_H_ | 211 #endif // SYNC_SESSIONS_NUDGE_TRACKER_H_ |
| OLD | NEW |