| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 6 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 7 #define CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 7 #define CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| 8 #pragma once | 8 #pragma once |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const syncable::ModelTypePayloadMap& types_with_payloads, | 90 const syncable::ModelTypePayloadMap& types_with_payloads, |
| 91 const tracked_objects::Location& nudge_location); | 91 const tracked_objects::Location& nudge_location); |
| 92 | 92 |
| 93 // Note: The source argument of this function must come from the subset of | 93 // Note: The source argument of this function must come from the subset of |
| 94 // GetUpdatesCallerInfo values related to configurations. | 94 // GetUpdatesCallerInfo values related to configurations. |
| 95 void ScheduleConfig( | 95 void ScheduleConfig( |
| 96 const syncable::ModelTypeBitSet& types, | 96 const syncable::ModelTypeBitSet& types, |
| 97 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | 97 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| 98 | 98 |
| 99 void ScheduleClearUserData(); | 99 void ScheduleClearUserData(); |
| 100 // If this is called before Start(), the cleanup is guaranteed to |
| 101 // happen before the Start finishes. |
| 102 // |
| 103 // TODO(akalin): Figure out how to test this. |
| 100 void ScheduleCleanupDisabledTypes(); | 104 void ScheduleCleanupDisabledTypes(); |
| 101 | 105 |
| 102 // Change status of notifications in the SyncSessionContext. | 106 // Change status of notifications in the SyncSessionContext. |
| 103 void set_notifications_enabled(bool notifications_enabled); | 107 void set_notifications_enabled(bool notifications_enabled); |
| 104 | 108 |
| 105 base::TimeDelta sessions_commit_delay() const; | 109 base::TimeDelta sessions_commit_delay() const; |
| 106 | 110 |
| 107 // DDOS avoidance function. Calculates how long we should wait before trying | 111 // DDOS avoidance function. Calculates how long we should wait before trying |
| 108 // again after a failed sync attempt, where the last delay was |base_delay|. | 112 // again after a failed sync attempt, where the last delay was |base_delay|. |
| 109 // TODO(tim): Look at URLRequestThrottlerEntryInterface. | 113 // TODO(tim): Look at URLRequestThrottlerEntryInterface. |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void StartImpl(Mode mode, ModeChangeCallback* callback); | 309 void StartImpl(Mode mode, ModeChangeCallback* callback); |
| 306 void ScheduleNudgeImpl( | 310 void ScheduleNudgeImpl( |
| 307 const base::TimeDelta& delay, | 311 const base::TimeDelta& delay, |
| 308 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 312 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 309 const syncable::ModelTypePayloadMap& types_with_payloads, | 313 const syncable::ModelTypePayloadMap& types_with_payloads, |
| 310 bool is_canary_job, const tracked_objects::Location& nudge_location); | 314 bool is_canary_job, const tracked_objects::Location& nudge_location); |
| 311 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, | 315 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, |
| 312 const std::vector<ModelSafeWorker*>& workers, | 316 const std::vector<ModelSafeWorker*>& workers, |
| 313 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | 317 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| 314 void ScheduleClearUserDataImpl(); | 318 void ScheduleClearUserDataImpl(); |
| 315 void ScheduleCleanupDisabledTypesImpl(); | |
| 316 | 319 |
| 317 // Returns true if the client is currently in exponential backoff. | 320 // Returns true if the client is currently in exponential backoff. |
| 318 bool IsBackingOff() const; | 321 bool IsBackingOff() const; |
| 319 | 322 |
| 320 // Helper to signal all listeners registered with |session_context_|. | 323 // Helper to signal all listeners registered with |session_context_|. |
| 321 void Notify(SyncEngineEvent::EventCause cause); | 324 void Notify(SyncEngineEvent::EventCause cause); |
| 322 | 325 |
| 323 // Callback to change backoff state. | 326 // Callback to change backoff state. |
| 324 void DoCanaryJob(); | 327 void DoCanaryJob(); |
| 325 void Unthrottle(); | 328 void Unthrottle(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 scoped_ptr<Syncer> syncer_; | 405 scoped_ptr<Syncer> syncer_; |
| 403 | 406 |
| 404 scoped_ptr<sessions::SyncSessionContext> session_context_; | 407 scoped_ptr<sessions::SyncSessionContext> session_context_; |
| 405 | 408 |
| 406 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 409 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
| 407 }; | 410 }; |
| 408 | 411 |
| 409 } // namespace browser_sync | 412 } // namespace browser_sync |
| 410 | 413 |
| 411 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 414 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |