| 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/base/sync_export.h" | |
| 17 #include "components/sync/engine_impl/nudge_source.h" | 16 #include "components/sync/engine_impl/nudge_source.h" |
| 18 #include "components/sync/sessions_impl/sync_session.h" | 17 #include "components/sync/sessions_impl/sync_session.h" |
| 19 | 18 |
| 20 namespace tracked_objects { | 19 namespace tracked_objects { |
| 21 class Location; | 20 class Location; |
| 22 } // namespace tracked_objects | 21 } // namespace tracked_objects |
| 23 | 22 |
| 24 namespace syncer { | 23 namespace syncer { |
| 25 | 24 |
| 26 struct ServerConnectionEvent; | 25 struct ServerConnectionEvent; |
| 27 | 26 |
| 28 struct SYNC_EXPORT ConfigurationParams { | 27 struct ConfigurationParams { |
| 29 ConfigurationParams(); | 28 ConfigurationParams(); |
| 30 ConfigurationParams( | 29 ConfigurationParams( |
| 31 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, | 30 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, |
| 32 ModelTypeSet types_to_download, | 31 ModelTypeSet types_to_download, |
| 33 const ModelSafeRoutingInfo& routing_info, | 32 const ModelSafeRoutingInfo& routing_info, |
| 34 const base::Closure& ready_task, | 33 const base::Closure& ready_task, |
| 35 const base::Closure& retry_task); | 34 const base::Closure& retry_task); |
| 36 ConfigurationParams(const ConfigurationParams& other); | 35 ConfigurationParams(const ConfigurationParams& other); |
| 37 ~ConfigurationParams(); | 36 ~ConfigurationParams(); |
| 38 | 37 |
| 39 // Source for the configuration. | 38 // Source for the configuration. |
| 40 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; | 39 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; |
| 41 // The types that should be downloaded. | 40 // The types that should be downloaded. |
| 42 ModelTypeSet types_to_download; | 41 ModelTypeSet types_to_download; |
| 43 // The new routing info (superset of types to be downloaded). | 42 // The new routing info (superset of types to be downloaded). |
| 44 ModelSafeRoutingInfo routing_info; | 43 ModelSafeRoutingInfo routing_info; |
| 45 // Callback to invoke on configuration completion. | 44 // Callback to invoke on configuration completion. |
| 46 base::Closure ready_task; | 45 base::Closure ready_task; |
| 47 // Callback to invoke on configuration failure. | 46 // Callback to invoke on configuration failure. |
| 48 base::Closure retry_task; | 47 base::Closure retry_task; |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 struct SYNC_EXPORT ClearParams { | 50 struct ClearParams { |
| 52 explicit ClearParams(const base::Closure& report_success_task); | 51 explicit ClearParams(const base::Closure& report_success_task); |
| 53 ClearParams(const ClearParams& other); | 52 ClearParams(const ClearParams& other); |
| 54 ~ClearParams(); | 53 ~ClearParams(); |
| 55 | 54 |
| 56 // Callback to invoke on successful completion. | 55 // Callback to invoke on successful completion. |
| 57 base::Closure report_success_task; | 56 base::Closure report_success_task; |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 class SYNC_EXPORT SyncScheduler : public sessions::SyncSession::Delegate { | 59 class SyncScheduler : public sessions::SyncSession::Delegate { |
| 61 public: | 60 public: |
| 62 enum Mode { | 61 enum Mode { |
| 63 // In this mode, the thread only performs configuration tasks. This is | 62 // In this mode, the thread only performs configuration tasks. This is |
| 64 // 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 |
| 65 // 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 |
| 66 // normal mode. | 65 // normal mode. |
| 67 CONFIGURATION_MODE, | 66 CONFIGURATION_MODE, |
| 68 // 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 |
| 69 // 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 |
| 70 // this mode, the only schedulable operation is |SchedulerClearServerData|. | 69 // this mode, the only schedulable operation is |SchedulerClearServerData|. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Called when credentials are updated by the user. | 149 // Called when credentials are updated by the user. |
| 151 virtual void OnCredentialsUpdated() = 0; | 150 virtual void OnCredentialsUpdated() = 0; |
| 152 | 151 |
| 153 // Called when the network layer detects a connection status change. | 152 // Called when the network layer detects a connection status change. |
| 154 virtual void OnConnectionStatusChange() = 0; | 153 virtual void OnConnectionStatusChange() = 0; |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 } // namespace syncer | 156 } // namespace syncer |
| 158 | 157 |
| 159 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ | 158 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_SCHEDULER_H_ |
| OLD | NEW |