| 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; | 94 |
| 95 // Returns the time of the next type unthrottling or unbackoff. |
| 96 base::TimeDelta GetTimeUntilNextUnblock() const; |
| 97 |
| 98 // Returns the time of for type last backing off interval. |
| 99 base::TimeDelta GetTypeLastBackoffInterval(ModelType type) const; |
| 93 | 100 |
| 94 // Returns true if any type is currenlty throttled. | 101 // Returns true if any type is currenlty throttled. |
| 95 bool IsAnyTypeThrottled() const; | 102 bool IsAnyTypeThrottled() const; |
| 96 | 103 |
| 104 // Returns true if any type is currenlty backed off. |
| 105 bool IsAnyTypeBackedOff() const; |
| 106 |
| 97 // Returns true if |type| is currently throttled. | 107 // Returns true if |type| is currently throttled. |
| 98 bool IsTypeThrottled(ModelType type) const; | 108 bool IsTypeThrottled(ModelType type) const; |
| 99 | 109 |
| 110 // Returns true if |type| is currently backed off. |
| 111 bool IsTypeBackedOff(ModelType type) const; |
| 112 |
| 100 // Returns the set of currently throttled types. | 113 // Returns the set of currently throttled types. |
| 101 ModelTypeSet GetThrottledTypes() const; | 114 ModelTypeSet GetThrottledTypes() const; |
| 102 | 115 |
| 116 // Returns the set of currently backed off types. |
| 117 ModelTypeSet GetBackedOffTypes() const; |
| 118 |
| 103 // Returns the set of types with local changes pending. | 119 // Returns the set of types with local changes pending. |
| 104 ModelTypeSet GetNudgedTypes() const; | 120 ModelTypeSet GetNudgedTypes() const; |
| 105 | 121 |
| 106 // Returns the set of types that have pending invalidations. | 122 // Returns the set of types that have pending invalidations. |
| 107 ModelTypeSet GetNotifiedTypes() const; | 123 ModelTypeSet GetNotifiedTypes() const; |
| 108 | 124 |
| 109 // Returns the set of types that have pending refresh requests. | 125 // Returns the set of types that have pending refresh requests. |
| 110 ModelTypeSet GetRefreshRequestedTypes() const; | 126 ModelTypeSet GetRefreshRequestedTypes() const; |
| 111 | 127 |
| 112 // Returns the 'source' of the GetUpdate request. | 128 // Returns the 'source' of the GetUpdate request. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 base::TimeDelta minimum_local_nudge_delay_; | 213 base::TimeDelta minimum_local_nudge_delay_; |
| 198 base::TimeDelta local_refresh_nudge_delay_; | 214 base::TimeDelta local_refresh_nudge_delay_; |
| 199 base::TimeDelta remote_invalidation_nudge_delay_; | 215 base::TimeDelta remote_invalidation_nudge_delay_; |
| 200 | 216 |
| 201 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); | 217 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
| 202 }; | 218 }; |
| 203 | 219 |
| 204 } // namespace syncer | 220 } // namespace syncer |
| 205 | 221 |
| 206 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ | 222 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ |
| OLD | NEW |