| 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. | 5 // A class to schedule syncer tasks intelligently. |
| 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ | 6 #ifndef SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ | 7 #define SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 CONFIGURATION_MODE, | 57 CONFIGURATION_MODE, |
| 58 // Resumes polling and allows nudges, drops configuration tasks. Runs | 58 // Resumes polling and allows nudges, drops configuration tasks. Runs |
| 59 // through entire sync cycle. | 59 // through entire sync cycle. |
| 60 NORMAL_MODE, | 60 NORMAL_MODE, |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // All methods of SyncScheduler must be called on the same thread | 63 // All methods of SyncScheduler must be called on the same thread |
| 64 // (except for RequestEarlyExit()). | 64 // (except for RequestEarlyExit()). |
| 65 | 65 |
| 66 SyncScheduler(); | 66 SyncScheduler(); |
| 67 virtual ~SyncScheduler(); | 67 ~SyncScheduler() override; |
| 68 | 68 |
| 69 // Start the scheduler with the given mode. If the scheduler is | 69 // Start the scheduler with the given mode. If the scheduler is |
| 70 // already started, switch to the given mode, although some | 70 // already started, switch to the given mode, although some |
| 71 // scheduled tasks from the old mode may still run. | 71 // scheduled tasks from the old mode may still run. |
| 72 virtual void Start(Mode mode) = 0; | 72 virtual void Start(Mode mode) = 0; |
| 73 | 73 |
| 74 // Schedules the configuration task specified by |params|. Returns true if | 74 // Schedules the configuration task specified by |params|. Returns true if |
| 75 // the configuration task executed immediately, false if it had to be | 75 // the configuration task executed immediately, false if it had to be |
| 76 // scheduled for a later attempt. |params.ready_task| is invoked whenever the | 76 // scheduled for a later attempt. |params.ready_task| is invoked whenever the |
| 77 // configuration task executes. |params.retry_task| is invoked once if the | 77 // configuration task executes. |params.retry_task| is invoked once if the |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Called when credentials are updated by the user. | 130 // Called when credentials are updated by the user. |
| 131 virtual void OnCredentialsUpdated() = 0; | 131 virtual void OnCredentialsUpdated() = 0; |
| 132 | 132 |
| 133 // Called when the network layer detects a connection status change. | 133 // Called when the network layer detects a connection status change. |
| 134 virtual void OnConnectionStatusChange() = 0; | 134 virtual void OnConnectionStatusChange() = 0; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 } // namespace syncer | 137 } // namespace syncer |
| 138 | 138 |
| 139 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 139 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |