| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
| 9 #define CHROME_BROWSER_SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 9 #define CHROME_BROWSER_SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 PendingRegistrationMap; | 60 PendingRegistrationMap; |
| 61 | 61 |
| 62 // Does not take ownership of |invalidation_client_|. | 62 // Does not take ownership of |invalidation_client_|. |
| 63 explicit RegistrationManager( | 63 explicit RegistrationManager( |
| 64 invalidation::InvalidationClient* invalidation_client); | 64 invalidation::InvalidationClient* invalidation_client); |
| 65 | 65 |
| 66 virtual ~RegistrationManager(); | 66 virtual ~RegistrationManager(); |
| 67 | 67 |
| 68 // Registers all types included in the given set (that are not | 68 // Registers all types included in the given set (that are not |
| 69 // already disabled) and sets all other types to be unregistered. | 69 // already disabled) and sets all other types to be unregistered. |
| 70 void SetRegisteredTypes(syncable::ModelEnumSet types); | 70 void SetRegisteredTypes(syncable::ModelTypeSet types); |
| 71 | 71 |
| 72 // Marks the registration for the |model_type| lost and re-registers | 72 // Marks the registration for the |model_type| lost and re-registers |
| 73 // it (unless it's disabled). | 73 // it (unless it's disabled). |
| 74 void MarkRegistrationLost(syncable::ModelType model_type); | 74 void MarkRegistrationLost(syncable::ModelType model_type); |
| 75 | 75 |
| 76 // Marks registrations lost for all enabled types and re-registers | 76 // Marks registrations lost for all enabled types and re-registers |
| 77 // them. | 77 // them. |
| 78 void MarkAllRegistrationsLost(); | 78 void MarkAllRegistrationsLost(); |
| 79 | 79 |
| 80 // Marks the registration for the |model_type| permanently lost and | 80 // Marks the registration for the |model_type| permanently lost and |
| 81 // blocks any future registration attempts. | 81 // blocks any future registration attempts. |
| 82 void DisableType(syncable::ModelType model_type); | 82 void DisableType(syncable::ModelType model_type); |
| 83 | 83 |
| 84 // The functions below should only be used in tests. | 84 // The functions below should only be used in tests. |
| 85 | 85 |
| 86 // Gets all currently-registered types. | 86 // Gets all currently-registered types. |
| 87 syncable::ModelEnumSet GetRegisteredTypes() const; | 87 syncable::ModelTypeSet GetRegisteredTypes() const; |
| 88 | 88 |
| 89 // Gets all pending registrations and their next min delays. | 89 // Gets all pending registrations and their next min delays. |
| 90 PendingRegistrationMap GetPendingRegistrations() const; | 90 PendingRegistrationMap GetPendingRegistrations() const; |
| 91 | 91 |
| 92 // Run pending registrations immediately. | 92 // Run pending registrations immediately. |
| 93 void FirePendingRegistrationsForTest(); | 93 void FirePendingRegistrationsForTest(); |
| 94 | 94 |
| 95 // Calculate exponential backoff. |jitter| must be Uniform[-1.0, | 95 // Calculate exponential backoff. |jitter| must be Uniform[-1.0, |
| 96 // 1.0]. | 96 // 1.0]. |
| 97 static double CalculateBackoff(double retry_interval, | 97 static double CalculateBackoff(double retry_interval, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 RegistrationStatus registration_statuses_[syncable::MODEL_TYPE_COUNT]; | 167 RegistrationStatus registration_statuses_[syncable::MODEL_TYPE_COUNT]; |
| 168 // Weak pointer. | 168 // Weak pointer. |
| 169 invalidation::InvalidationClient* invalidation_client_; | 169 invalidation::InvalidationClient* invalidation_client_; |
| 170 | 170 |
| 171 DISALLOW_COPY_AND_ASSIGN(RegistrationManager); | 171 DISALLOW_COPY_AND_ASSIGN(RegistrationManager); |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 } // namespace sync_notifier | 174 } // namespace sync_notifier |
| 175 | 175 |
| 176 #endif // CHROME_BROWSER_SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 176 #endif // CHROME_BROWSER_SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
| OLD | NEW |