| OLD | NEW |
| 1 // Copyright 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 to schedule syncer tasks intelligently. | |
| 6 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ |
| 7 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ |
| 8 | 7 |
| 9 #include <memory> | 8 #include <memory> |
| 10 #include <string> | 9 #include <string> |
| 11 | 10 |
| 12 #include "base/callback.h" | 11 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 14 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 15 #include "components/sync/base/invalidation_interface.h" | 14 #include "components/sync/base/invalidation_interface.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 48 |
| 50 struct ClearParams { | 49 struct ClearParams { |
| 51 explicit ClearParams(const base::Closure& report_success_task); | 50 explicit ClearParams(const base::Closure& report_success_task); |
| 52 ClearParams(const ClearParams& other); | 51 ClearParams(const ClearParams& other); |
| 53 ~ClearParams(); | 52 ~ClearParams(); |
| 54 | 53 |
| 55 // Callback to invoke on successful completion. | 54 // Callback to invoke on successful completion. |
| 56 base::Closure report_success_task; | 55 base::Closure report_success_task; |
| 57 }; | 56 }; |
| 58 | 57 |
| 58 // A class to schedule syncer tasks intelligently. |
| 59 class SyncScheduler : public SyncCycle::Delegate { | 59 class SyncScheduler : public SyncCycle::Delegate { |
| 60 public: | 60 public: |
| 61 enum Mode { | 61 enum Mode { |
| 62 // In this mode, the thread only performs configuration tasks. This is | 62 // In this mode, the thread only performs configuration tasks. This is |
| 63 // designed to make the case where we want to download updates for a | 63 // designed to make the case where we want to download updates for a |
| 64 // specific type only, and not continue syncing until we are moved into | 64 // specific type only, and not continue syncing until we are moved into |
| 65 // normal mode. | 65 // normal mode. |
| 66 CONFIGURATION_MODE, | 66 CONFIGURATION_MODE, |
| 67 // This mode is used to issue a clear server data command. The scheduler | 67 // This mode is used to issue a clear server data command. The scheduler |
| 68 // may only transition to this mode from the CONFIGURATION_MODE. When in | 68 // may only transition to this mode from the CONFIGURATION_MODE. When in |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Called when credentials are updated by the user. | 149 // Called when credentials are updated by the user. |
| 150 virtual void OnCredentialsUpdated() = 0; | 150 virtual void OnCredentialsUpdated() = 0; |
| 151 | 151 |
| 152 // Called when the network layer detects a connection status change. | 152 // Called when the network layer detects a connection status change. |
| 153 virtual void OnConnectionStatusChange() = 0; | 153 virtual void OnConnectionStatusChange() = 0; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace syncer | 156 } // namespace syncer |
| 157 | 157 |
| 158 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ | 158 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ |
| OLD | NEW |