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 #include "chrome/browser/sync/notifier/registration_manager.h" | 5 #include "chrome/browser/sync/notifier/registration_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 status->last_registration_attempt) + | 186 status->last_registration_attempt) + |
187 status->next_delay; | 187 status->next_delay; |
188 base::TimeDelta delay = | 188 base::TimeDelta delay = |
189 (status->delay <= base::TimeDelta()) ? | 189 (status->delay <= base::TimeDelta()) ? |
190 base::TimeDelta() : status->delay; | 190 base::TimeDelta() : status->delay; |
191 VLOG(2) << "Registering " | 191 VLOG(2) << "Registering " |
192 << syncable::ModelTypeToString(model_type) << " in " | 192 << syncable::ModelTypeToString(model_type) << " in " |
193 << delay.InMilliseconds() << " ms"; | 193 << delay.InMilliseconds() << " ms"; |
194 status->registration_timer.Stop(); | 194 status->registration_timer.Stop(); |
195 status->registration_timer.Start( | 195 status->registration_timer.Start( |
196 delay, status, &RegistrationManager::RegistrationStatus::DoRegister); | 196 delay, status, &RegistrationManager::RegistrationStatus::DoRegister, |
| 197 FROM_HERE); |
197 double next_delay_seconds = | 198 double next_delay_seconds = |
198 CalculateBackoff(static_cast<double>(status->next_delay.InSeconds()), | 199 CalculateBackoff(static_cast<double>(status->next_delay.InSeconds()), |
199 kInitialRegistrationDelaySeconds, | 200 kInitialRegistrationDelaySeconds, |
200 kMinRegistrationDelaySeconds, | 201 kMinRegistrationDelaySeconds, |
201 kMaxRegistrationDelaySeconds, | 202 kMaxRegistrationDelaySeconds, |
202 kRegistrationDelayExponent, | 203 kRegistrationDelayExponent, |
203 GetJitter(), | 204 GetJitter(), |
204 kRegistrationDelayMaxJitter); | 205 kRegistrationDelayMaxJitter); |
205 status->next_delay = | 206 status->next_delay = |
206 base::TimeDelta::FromSeconds(static_cast<int64>(next_delay_seconds)); | 207 base::TimeDelta::FromSeconds(static_cast<int64>(next_delay_seconds)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 243 } |
243 | 244 |
244 bool RegistrationManager::IsTypeRegistered( | 245 bool RegistrationManager::IsTypeRegistered( |
245 syncable::ModelType model_type) const { | 246 syncable::ModelType model_type) const { |
246 DCHECK(non_thread_safe_.CalledOnValidThread()); | 247 DCHECK(non_thread_safe_.CalledOnValidThread()); |
247 return registration_statuses_[model_type].state == | 248 return registration_statuses_[model_type].state == |
248 invalidation::InvalidationListener::REGISTERED; | 249 invalidation::InvalidationListener::REGISTERED; |
249 } | 250 } |
250 | 251 |
251 } // namespace sync_notifier | 252 } // namespace sync_notifier |
OLD | NEW |