| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // SyncScheduler: | 36 // SyncScheduler: |
| 37 void Start(const base::TimeDelta& elapsed_time_since_last_sync, | 37 void Start(const base::TimeDelta& elapsed_time_since_last_sync, |
| 38 Strategy strategy) override; | 38 Strategy strategy) override; |
| 39 void ForceSync() override; | 39 void ForceSync() override; |
| 40 base::TimeDelta GetTimeToNextSync() const override; | 40 base::TimeDelta GetTimeToNextSync() const override; |
| 41 Strategy GetStrategy() const override; | 41 Strategy GetStrategy() const override; |
| 42 SyncState GetSyncState() const override; | 42 SyncState GetSyncState() const override; |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 // Creates and returns a base::Timer object. Exposed for testing. | 45 // Creates and returns a base::Timer object. Exposed for testing. |
| 46 virtual scoped_ptr<base::Timer> CreateTimer(); | 46 virtual std::unique_ptr<base::Timer> CreateTimer(); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // SyncScheduler: | 49 // SyncScheduler: |
| 50 void OnSyncCompleted(bool success) override; | 50 void OnSyncCompleted(bool success) override; |
| 51 | 51 |
| 52 // Called when |timer_| is fired. | 52 // Called when |timer_| is fired. |
| 53 void OnTimerFired(); | 53 void OnTimerFired(); |
| 54 | 54 |
| 55 // Schedules |timer_| for the next sync request. | 55 // Schedules |timer_| for the next sync request. |
| 56 void ScheduleNextSync(const base::TimeDelta& sync_delta); | 56 void ScheduleNextSync(const base::TimeDelta& sync_delta); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 85 Strategy strategy_; | 85 Strategy strategy_; |
| 86 | 86 |
| 87 // The current state of the scheduler. | 87 // The current state of the scheduler. |
| 88 SyncState sync_state_; | 88 SyncState sync_state_; |
| 89 | 89 |
| 90 // The number of failed syncs made in a row. Once a sync request succeeds, | 90 // The number of failed syncs made in a row. Once a sync request succeeds, |
| 91 // this counter is reset. | 91 // this counter is reset. |
| 92 size_t failure_count_; | 92 size_t failure_count_; |
| 93 | 93 |
| 94 // Timer firing for the next sync request. | 94 // Timer firing for the next sync request. |
| 95 scoped_ptr<base::Timer> timer_; | 95 std::unique_ptr<base::Timer> timer_; |
| 96 | 96 |
| 97 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; | 97 base::WeakPtrFactory<SyncSchedulerImpl> weak_ptr_factory_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); | 99 DISALLOW_COPY_AND_ASSIGN(SyncSchedulerImpl); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace proximity_auth | 102 } // namespace proximity_auth |
| 103 | 103 |
| 104 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H | 104 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_CRYPTAUTH_SYNC_SCHEDULER_IMPL_H |
| OLD | NEW |