OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 |
11 #include <map> | 11 #include <map> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/timer.h" | 16 #include "base/timer.h" |
17 // For invalidation::InvalidationListener::RegistrationState. | 17 // For invalidation::InvalidationListener::RegistrationState. |
18 #include "google/cacheinvalidation/include/invalidation-listener.h" | 18 #include "google/cacheinvalidation/include/invalidation-listener.h" |
19 #include "google/cacheinvalidation/include/types.h" | 19 #include "google/cacheinvalidation/include/types.h" |
| 20 #include "sync/base/sync_export.h" |
20 #include "sync/notifier/invalidation_util.h" | 21 #include "sync/notifier/invalidation_util.h" |
21 | 22 |
22 namespace syncer { | 23 namespace syncer { |
23 | 24 |
24 using ::invalidation::InvalidationListener; | 25 using ::invalidation::InvalidationListener; |
25 | 26 |
26 // Manages the details of registering types for invalidation. | 27 // Manages the details of registering types for invalidation. |
27 // Implements exponential backoff for repeated registration attempts | 28 // Implements exponential backoff for repeated registration attempts |
28 // to the invalidation client. | 29 // to the invalidation client. |
29 // | 30 // |
30 // TODO(akalin): Consolidate exponential backoff code. Other | 31 // TODO(akalin): Consolidate exponential backoff code. Other |
31 // implementations include the syncer thread (both versions) and XMPP | 32 // implementations include the syncer thread (both versions) and XMPP |
32 // retries. The most sophisticated one is URLRequestThrottler; making | 33 // retries. The most sophisticated one is URLRequestThrottler; making |
33 // that generic should work for everyone. | 34 // that generic should work for everyone. |
34 class RegistrationManager : public base::NonThreadSafe { | 35 class SYNC_EXPORT_PRIVATE RegistrationManager : public base::NonThreadSafe { |
35 public: | 36 public: |
36 // Constants for exponential backoff (used by tests). | 37 // Constants for exponential backoff (used by tests). |
37 static const int kInitialRegistrationDelaySeconds; | 38 static const int kInitialRegistrationDelaySeconds; |
38 static const int kRegistrationDelayExponent; | 39 static const int kRegistrationDelayExponent; |
39 static const double kRegistrationDelayMaxJitter; | 40 static const double kRegistrationDelayMaxJitter; |
40 static const int kMinRegistrationDelaySeconds; | 41 static const int kMinRegistrationDelaySeconds; |
41 static const int kMaxRegistrationDelaySeconds; | 42 static const int kMaxRegistrationDelaySeconds; |
42 | 43 |
43 // Types used by testing functions. | 44 // Types used by testing functions. |
44 struct PendingRegistrationInfo { | 45 struct PendingRegistrationInfo { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 RegistrationStatusMap registration_statuses_; | 178 RegistrationStatusMap registration_statuses_; |
178 // Weak pointer. | 179 // Weak pointer. |
179 invalidation::InvalidationClient* invalidation_client_; | 180 invalidation::InvalidationClient* invalidation_client_; |
180 | 181 |
181 DISALLOW_COPY_AND_ASSIGN(RegistrationManager); | 182 DISALLOW_COPY_AND_ASSIGN(RegistrationManager); |
182 }; | 183 }; |
183 | 184 |
184 } // namespace syncer | 185 } // namespace syncer |
185 | 186 |
186 #endif // SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ | 187 #endif // SYNC_NOTIFIER_REGISTRATION_MANAGER_H_ |
OLD | NEW |