Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 that manages the registration of types for server-issued | 5 // A class that manages the registration of types for server-issued |
| 6 // notifications. | 6 // notifications. |
| 7 | 7 |
| 8 #ifndef SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 8 #ifndef SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
| 9 #define SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 9 #define SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 ObjectIdLessThan> | 61 ObjectIdLessThan> |
| 62 PendingRegistrationMap; | 62 PendingRegistrationMap; |
| 63 | 63 |
| 64 // Does not take ownership of |invalidation_client_|. | 64 // Does not take ownership of |invalidation_client_|. |
| 65 explicit RegistrationManager( | 65 explicit RegistrationManager( |
| 66 invalidation::InvalidationClient* invalidation_client); | 66 invalidation::InvalidationClient* invalidation_client); |
| 67 | 67 |
| 68 virtual ~RegistrationManager(); | 68 virtual ~RegistrationManager(); |
| 69 | 69 |
| 70 // Registers all object IDs included in the given set (that are not | 70 // Registers all object IDs included in the given set (that are not |
| 71 // already disabled) and unregisters all other object IDs. | 71 // already disabled) and unregisters all other object IDs. The return value is |
| 72 void UpdateRegisteredIds(const ObjectIdSet& ids); | 72 // the set of IDs that was unregistered. |
| 73 ObjectIdSet UpdateRegisteredIds(const ObjectIdSet& ids); | |
|
akalin
2012/08/22 19:57:30
what do you think of making GetRegisteredIdsForTes
dcheng
2012/08/24 01:35:25
I'm not opposed to exposing it publicly.
However,
akalin
2012/08/29 17:33:54
Yeah, you're right about the funky flow. Actually
| |
| 73 | 74 |
| 74 // Marks the registration for the |id| lost and re-registers | 75 // Marks the registration for the |id| lost and re-registers |
| 75 // it (unless it's disabled). | 76 // it (unless it's disabled). |
| 76 void MarkRegistrationLost(const invalidation::ObjectId& id); | 77 void MarkRegistrationLost(const invalidation::ObjectId& id); |
| 77 | 78 |
| 78 // Marks registrations lost for all enabled object IDs and re-registers them. | 79 // Marks registrations lost for all enabled object IDs and re-registers them. |
| 79 void MarkAllRegistrationsLost(); | 80 void MarkAllRegistrationsLost(); |
| 80 | 81 |
| 81 // Marks the registration for the |id| permanently lost and blocks any future | 82 // Marks the registration for the |id| permanently lost and blocks any future |
| 82 // registration attempts. | 83 // registration attempts. |
| 83 void DisableId(const invalidation::ObjectId& id); | 84 void DisableId(const invalidation::ObjectId& id); |
|
akalin
2012/08/22 19:57:30
should we also Forget the ID if we call this?
dcheng
2012/08/24 01:35:25
I think we probably still want to keep it in this
akalin
2012/08/29 17:33:54
Maybe add a comment to that effect when this is ca
dcheng
2012/08/31 05:56:47
Done.
| |
| 84 | 85 |
| 85 // Calculate exponential backoff. |jitter| must be Uniform[-1.0, 1.0]. | 86 // Calculate exponential backoff. |jitter| must be Uniform[-1.0, 1.0]. |
| 86 static double CalculateBackoff(double retry_interval, | 87 static double CalculateBackoff(double retry_interval, |
| 87 double initial_retry_interval, | 88 double initial_retry_interval, |
| 88 double min_retry_interval, | 89 double min_retry_interval, |
| 89 double max_retry_interval, | 90 double max_retry_interval, |
| 90 double backoff_exponent, | 91 double backoff_exponent, |
| 91 double jitter, | 92 double jitter, |
| 92 double max_jitter); | 93 double max_jitter); |
| 93 | 94 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 RegistrationStatusMap registration_statuses_; | 177 RegistrationStatusMap registration_statuses_; |
| 177 // Weak pointer. | 178 // Weak pointer. |
| 178 invalidation::InvalidationClient* invalidation_client_; | 179 invalidation::InvalidationClient* invalidation_client_; |
| 179 | 180 |
| 180 DISALLOW_COPY_AND_ASSIGN(RegistrationManager); | 181 DISALLOW_COPY_AND_ASSIGN(RegistrationManager); |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 } // namespace syncer | 184 } // namespace syncer |
| 184 | 185 |
| 185 #endif // SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 186 #endif // SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
| OLD | NEW |