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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ~SyncScheduler() override; | 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. |last_poll_time| will | 71 // scheduled tasks from the old mode may still run. |
72 // be used to decide what the poll timer should be initialized with. | 72 virtual void Start(Mode mode) = 0; |
73 virtual void Start(Mode mode, base::Time last_poll_time) = 0; | |
74 | 73 |
75 // Schedules the configuration task specified by |params|. Returns true if | 74 // Schedules the configuration task specified by |params|. Returns true if |
76 // the configuration task executed immediately, false if it had to be | 75 // the configuration task executed immediately, false if it had to be |
77 // 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 |
78 // configuration task executes. |params.retry_task| is invoked once if the | 77 // configuration task executes. |params.retry_task| is invoked once if the |
79 // configuration task could not execute. |params.ready_task| will still be | 78 // configuration task could not execute. |params.ready_task| will still be |
80 // called when configuration finishes. | 79 // called when configuration finishes. |
81 // Note: must already be in CONFIGURATION mode. | 80 // Note: must already be in CONFIGURATION mode. |
82 virtual void ScheduleConfiguration(const ConfigurationParams& params) = 0; | 81 virtual void ScheduleConfiguration(const ConfigurationParams& params) = 0; |
83 | 82 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Called when credentials are updated by the user. | 130 // Called when credentials are updated by the user. |
132 virtual void OnCredentialsUpdated() = 0; | 131 virtual void OnCredentialsUpdated() = 0; |
133 | 132 |
134 // Called when the network layer detects a connection status change. | 133 // Called when the network layer detects a connection status change. |
135 virtual void OnConnectionStatusChange() = 0; | 134 virtual void OnConnectionStatusChange() = 0; |
136 }; | 135 }; |
137 | 136 |
138 } // namespace syncer | 137 } // namespace syncer |
139 | 138 |
140 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 139 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
OLD | NEW |