| 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 COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // These functions should be called to keep this class informed of the status | 77 // These functions should be called to keep this class informed of the status |
| 78 // of the connection to the invalidations server. | 78 // of the connection to the invalidations server. |
| 79 void OnInvalidationsEnabled(); | 79 void OnInvalidationsEnabled(); |
| 80 void OnInvalidationsDisabled(); | 80 void OnInvalidationsDisabled(); |
| 81 | 81 |
| 82 // Marks |types| as being throttled from |now| until |now| + |length|. | 82 // Marks |types| as being throttled from |now| until |now| + |length|. |
| 83 void SetTypesThrottledUntil(ModelTypeSet types, | 83 void SetTypesThrottledUntil(ModelTypeSet types, |
| 84 base::TimeDelta length, | 84 base::TimeDelta length, |
| 85 base::TimeTicks now); | 85 base::TimeTicks now); |
| 86 | 86 |
| 87 // Removes any throttling that have expired by time |now|. | 87 // Marks |type| as being backed off from |now| until |now| + |length|. |
| 88 void UpdateTypeThrottlingState(base::TimeTicks now); | 88 void SetTypeBackedOff(ModelType type, |
| 89 base::TimeDelta length, |
| 90 base::TimeTicks now); |
| 89 | 91 |
| 90 // Returns the time of the next type unthrottling, relative to | 92 // Removes any throttling and backoff that have expired. |
| 91 // the input |now| value. | 93 void UpdateTypeThrottlingAndBackoffState(); |
| 92 base::TimeDelta GetTimeUntilNextUnthrottle(base::TimeTicks now) const; | |
| 93 | 94 |
| 94 // Returns true if any type is currenlty throttled. | 95 // Returns the time of the next type unthrottling or unbackoff. |
| 95 bool IsAnyTypeThrottled() const; | 96 base::TimeDelta GetTimeUntilNextUnblock() const; |
| 96 | 97 |
| 97 // Returns true if |type| is currently throttled. | 98 // Returns the time of for type last backing off interval. |
| 98 bool IsTypeThrottled(ModelType type) const; | 99 base::TimeDelta GetTypeLastBackoffInterval(ModelType type) const; |
| 99 | 100 |
| 100 // Returns the set of currently throttled types. | 101 // Returns true if any type is currenlty throttled or backed off. |
| 101 ModelTypeSet GetThrottledTypes() const; | 102 bool IsAnyTypeBlocked() const; |
| 103 |
| 104 // Returns true if |type| is currently blocked. |
| 105 bool IsTypeBlocked(ModelType type) const; |
| 106 |
| 107 // Returns |type|'s blocking mode. |
| 108 WaitInterval::BlockingMode GetTypeBlockingMode(ModelType type) const; |
| 109 |
| 110 // Returns the set of currently throttled or backed off types. |
| 111 ModelTypeSet GetBlockedTypes() const; |
| 102 | 112 |
| 103 // Returns the set of types with local changes pending. | 113 // Returns the set of types with local changes pending. |
| 104 ModelTypeSet GetNudgedTypes() const; | 114 ModelTypeSet GetNudgedTypes() const; |
| 105 | 115 |
| 106 // Returns the set of types that have pending invalidations. | 116 // Returns the set of types that have pending invalidations. |
| 107 ModelTypeSet GetNotifiedTypes() const; | 117 ModelTypeSet GetNotifiedTypes() const; |
| 108 | 118 |
| 109 // Returns the set of types that have pending refresh requests. | 119 // Returns the set of types that have pending refresh requests. |
| 110 ModelTypeSet GetRefreshRequestedTypes() const; | 120 ModelTypeSet GetRefreshRequestedTypes() const; |
| 111 | 121 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 base::TimeDelta minimum_local_nudge_delay_; | 207 base::TimeDelta minimum_local_nudge_delay_; |
| 198 base::TimeDelta local_refresh_nudge_delay_; | 208 base::TimeDelta local_refresh_nudge_delay_; |
| 199 base::TimeDelta remote_invalidation_nudge_delay_; | 209 base::TimeDelta remote_invalidation_nudge_delay_; |
| 200 | 210 |
| 201 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); | 211 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
| 202 }; | 212 }; |
| 203 | 213 |
| 204 } // namespace syncer | 214 } // namespace syncer |
| 205 | 215 |
| 206 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ | 216 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ |
| OLD | NEW |