| OLD | NEW |
| 1 // Copyright (c) 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "sync/base/sync_export.h" |
| 14 #include "sync/engine/nudge_source.h" | 15 #include "sync/engine/nudge_source.h" |
| 15 #include "sync/internal_api/public/base/model_type_invalidation_map.h" | 16 #include "sync/internal_api/public/base/model_type_invalidation_map.h" |
| 16 #include "sync/sessions/sync_session.h" | 17 #include "sync/sessions/sync_session.h" |
| 17 | 18 |
| 18 class MessageLoop; | 19 class MessageLoop; |
| 19 | 20 |
| 20 namespace tracked_objects { | 21 namespace tracked_objects { |
| 21 class Location; | 22 class Location; |
| 22 } // namespace tracked_objects | 23 } // namespace tracked_objects |
| 23 | 24 |
| 24 namespace syncer { | 25 namespace syncer { |
| 25 | 26 |
| 26 struct ServerConnectionEvent; | 27 struct ServerConnectionEvent; |
| 27 | 28 |
| 28 struct ConfigurationParams { | 29 struct SYNC_EXPORT_PRIVATE ConfigurationParams { |
| 29 ConfigurationParams(); | 30 ConfigurationParams(); |
| 30 ConfigurationParams( | 31 ConfigurationParams( |
| 31 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, | 32 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, |
| 32 ModelTypeSet types_to_download, | 33 ModelTypeSet types_to_download, |
| 33 const ModelSafeRoutingInfo& routing_info, | 34 const ModelSafeRoutingInfo& routing_info, |
| 34 const base::Closure& ready_task); | 35 const base::Closure& ready_task); |
| 35 ~ConfigurationParams(); | 36 ~ConfigurationParams(); |
| 36 | 37 |
| 37 // Source for the configuration. | 38 // Source for the configuration. |
| 38 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; | 39 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; |
| 39 // The types that should be downloaded. | 40 // The types that should be downloaded. |
| 40 ModelTypeSet types_to_download; | 41 ModelTypeSet types_to_download; |
| 41 // The new routing info (superset of types to be downloaded). | 42 // The new routing info (superset of types to be downloaded). |
| 42 ModelSafeRoutingInfo routing_info; | 43 ModelSafeRoutingInfo routing_info; |
| 43 // Callback to invoke on configuration completion. | 44 // Callback to invoke on configuration completion. |
| 44 base::Closure ready_task; | 45 base::Closure ready_task; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 class SyncScheduler : public sessions::SyncSession::Delegate { | 48 class SYNC_EXPORT_PRIVATE SyncScheduler |
| 49 : public sessions::SyncSession::Delegate { |
| 48 public: | 50 public: |
| 49 enum Mode { | 51 enum Mode { |
| 50 // In this mode, the thread only performs configuration tasks. This is | 52 // In this mode, the thread only performs configuration tasks. This is |
| 51 // designed to make the case where we want to download updates for a | 53 // designed to make the case where we want to download updates for a |
| 52 // specific type only, and not continue syncing until we are moved into | 54 // specific type only, and not continue syncing until we are moved into |
| 53 // normal mode. | 55 // normal mode. |
| 54 CONFIGURATION_MODE, | 56 CONFIGURATION_MODE, |
| 55 // Resumes polling and allows nudges, drops configuration tasks. Runs | 57 // Resumes polling and allows nudges, drops configuration tasks. Runs |
| 56 // through entire sync cycle. | 58 // through entire sync cycle. |
| 57 NORMAL_MODE, | 59 NORMAL_MODE, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Called when credentials are updated by the user. | 110 // Called when credentials are updated by the user. |
| 109 virtual void OnCredentialsUpdated() = 0; | 111 virtual void OnCredentialsUpdated() = 0; |
| 110 | 112 |
| 111 // Called when the network layer detects a connection status change. | 113 // Called when the network layer detects a connection status change. |
| 112 virtual void OnConnectionStatusChange() = 0; | 114 virtual void OnConnectionStatusChange() = 0; |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 } // namespace syncer | 117 } // namespace syncer |
| 116 | 118 |
| 117 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ | 119 #endif // SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |