| 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); |
| 91 |
| 92 // Removes any throttling and backoff that have expired by time |now|. |
| 93 void UpdateTypeThrottlingAndBackoffState(base::TimeTicks now); |
| 89 | 94 |
| 90 // Returns the time of the next type unthrottling, relative to | 95 // Returns the time of the next type unthrottling, relative to |
| 91 // the input |now| value. | 96 // the input |now| value. |
| 92 base::TimeDelta GetTimeUntilNextUnthrottle(base::TimeTicks now) const; | 97 base::TimeDelta GetTimeUntilNextUnthrottle(base::TimeTicks now) const; |
| 93 | 98 |
| 99 // Returns the time of the next type unbackoff, relative to |
| 100 // the input |now| value. |
| 101 base::TimeDelta GetTimeUntilNextUnbackoff(base::TimeTicks now) const; |
| 102 |
| 103 // Returns the time of for type last backing off interval. |
| 104 base::TimeDelta GetTypeLastBackoffInterval(ModelType type) const; |
| 105 |
| 94 // Returns true if any type is currenlty throttled. | 106 // Returns true if any type is currenlty throttled. |
| 95 bool IsAnyTypeThrottled() const; | 107 bool IsAnyTypeThrottled() const; |
| 96 | 108 |
| 109 // Returns true if any type is currenlty backed off. |
| 110 bool IsAnyTypeBackedOff() const; |
| 111 |
| 97 // Returns true if |type| is currently throttled. | 112 // Returns true if |type| is currently throttled. |
| 98 bool IsTypeThrottled(ModelType type) const; | 113 bool IsTypeThrottled(ModelType type) const; |
| 99 | 114 |
| 115 // Returns true if |type| is currently backed off. |
| 116 bool IsTypeBackedOff(ModelType type) const; |
| 117 |
| 100 // Returns the set of currently throttled types. | 118 // Returns the set of currently throttled types. |
| 101 ModelTypeSet GetThrottledTypes() const; | 119 ModelTypeSet GetThrottledTypes() const; |
| 102 | 120 |
| 121 // Returns the set of currently backed off types. |
| 122 ModelTypeSet GetBackedOffTypes() const; |
| 123 |
| 103 // Returns the set of types with local changes pending. | 124 // Returns the set of types with local changes pending. |
| 104 ModelTypeSet GetNudgedTypes() const; | 125 ModelTypeSet GetNudgedTypes() const; |
| 105 | 126 |
| 106 // Returns the set of types that have pending invalidations. | 127 // Returns the set of types that have pending invalidations. |
| 107 ModelTypeSet GetNotifiedTypes() const; | 128 ModelTypeSet GetNotifiedTypes() const; |
| 108 | 129 |
| 109 // Returns the set of types that have pending refresh requests. | 130 // Returns the set of types that have pending refresh requests. |
| 110 ModelTypeSet GetRefreshRequestedTypes() const; | 131 ModelTypeSet GetRefreshRequestedTypes() const; |
| 111 | 132 |
| 112 // Returns the 'source' of the GetUpdate request. | 133 // 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_; | 218 base::TimeDelta minimum_local_nudge_delay_; |
| 198 base::TimeDelta local_refresh_nudge_delay_; | 219 base::TimeDelta local_refresh_nudge_delay_; |
| 199 base::TimeDelta remote_invalidation_nudge_delay_; | 220 base::TimeDelta remote_invalidation_nudge_delay_; |
| 200 | 221 |
| 201 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); | 222 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); |
| 202 }; | 223 }; |
| 203 | 224 |
| 204 } // namespace syncer | 225 } // namespace syncer |
| 205 | 226 |
| 206 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ | 227 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ |
| OLD | NEW |