| 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 COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ | 6 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ |
| 7 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ | 7 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "components/sync/base/invalidation_interface.h" | 15 #include "components/sync/base/invalidation_interface.h" |
| 16 #include "components/sync/engine_impl/cycle/sync_cycle.h" |
| 16 #include "components/sync/engine_impl/nudge_source.h" | 17 #include "components/sync/engine_impl/nudge_source.h" |
| 17 #include "components/sync/sessions_impl/sync_session.h" | |
| 18 | 18 |
| 19 namespace tracked_objects { | 19 namespace tracked_objects { |
| 20 class Location; | 20 class Location; |
| 21 } // namespace tracked_objects | 21 } // namespace tracked_objects |
| 22 | 22 |
| 23 namespace syncer { | 23 namespace syncer { |
| 24 | 24 |
| 25 struct ServerConnectionEvent; | 25 struct ServerConnectionEvent; |
| 26 | 26 |
| 27 struct ConfigurationParams { | 27 struct ConfigurationParams { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 struct ClearParams { | 50 struct ClearParams { |
| 51 explicit ClearParams(const base::Closure& report_success_task); | 51 explicit ClearParams(const base::Closure& report_success_task); |
| 52 ClearParams(const ClearParams& other); | 52 ClearParams(const ClearParams& other); |
| 53 ~ClearParams(); | 53 ~ClearParams(); |
| 54 | 54 |
| 55 // Callback to invoke on successful completion. | 55 // Callback to invoke on successful completion. |
| 56 base::Closure report_success_task; | 56 base::Closure report_success_task; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class SyncScheduler : public sessions::SyncSession::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 |
| 69 // this mode, the only schedulable operation is |SchedulerClearServerData|. | 69 // this mode, the only schedulable operation is |SchedulerClearServerData|. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 const tracked_objects::Location& nudge_location) = 0; | 136 const tracked_objects::Location& nudge_location) = 0; |
| 137 | 137 |
| 138 // Requests a non-blocking initial sync request for the specified type. | 138 // Requests a non-blocking initial sync request for the specified type. |
| 139 // | 139 // |
| 140 // Many types can only complete initial sync while the scheduler is in | 140 // Many types can only complete initial sync while the scheduler is in |
| 141 // configure mode, but a few of them are able to perform their initial sync | 141 // configure mode, but a few of them are able to perform their initial sync |
| 142 // while the scheduler is in normal mode. This non-blocking initial sync | 142 // while the scheduler is in normal mode. This non-blocking initial sync |
| 143 // can be requested through this function. | 143 // can be requested through this function. |
| 144 virtual void ScheduleInitialSyncNudge(syncer::ModelType model_type) = 0; | 144 virtual void ScheduleInitialSyncNudge(syncer::ModelType model_type) = 0; |
| 145 | 145 |
| 146 // Change status of notifications in the SyncSessionContext. | 146 // Change status of notifications in the SyncCycleContext. |
| 147 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; | 147 virtual void SetNotificationsEnabled(bool notifications_enabled) = 0; |
| 148 | 148 |
| 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 |