| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, | 86 void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, |
| 87 const syncable::ModelTypeBitSet& types, | 87 const syncable::ModelTypeBitSet& types, |
| 88 const tracked_objects::Location& nudge_location); | 88 const tracked_objects::Location& nudge_location); |
| 89 void ScheduleNudgeWithPayloads( | 89 void ScheduleNudgeWithPayloads( |
| 90 const base::TimeDelta& delay, NudgeSource source, | 90 const base::TimeDelta& delay, NudgeSource source, |
| 91 const syncable::ModelTypePayloadMap& types_with_payloads, | 91 const syncable::ModelTypePayloadMap& types_with_payloads, |
| 92 const tracked_objects::Location& nudge_location); | 92 const tracked_objects::Location& nudge_location); |
| 93 void ScheduleConfig(const syncable::ModelTypeBitSet& types, | 93 void ScheduleConfig(const syncable::ModelTypeBitSet& types, |
| 94 sync_api::ConfigureReason reason); | 94 sync_api::ConfigureReason reason); |
| 95 void ScheduleClearUserData(); | 95 void ScheduleClearUserData(); |
| 96 // If this is called before Start(), the cleanup is guaranteed to |
| 97 // happen before the Start finishes. |
| 98 // |
| 99 // TODO(akalin): Figure out how to test this. |
| 96 void ScheduleCleanupDisabledTypes(); | 100 void ScheduleCleanupDisabledTypes(); |
| 97 | 101 |
| 98 // Change status of notifications in the SyncSessionContext. | 102 // Change status of notifications in the SyncSessionContext. |
| 99 void set_notifications_enabled(bool notifications_enabled); | 103 void set_notifications_enabled(bool notifications_enabled); |
| 100 | 104 |
| 101 base::TimeDelta sessions_commit_delay() const; | 105 base::TimeDelta sessions_commit_delay() const; |
| 102 | 106 |
| 103 // DDOS avoidance function. Calculates how long we should wait before trying | 107 // DDOS avoidance function. Calculates how long we should wait before trying |
| 104 // again after a failed sync attempt, where the last delay was |base_delay|. | 108 // again after a failed sync attempt, where the last delay was |base_delay|. |
| 105 // TODO(tim): Look at URLRequestThrottlerEntryInterface. | 109 // TODO(tim): Look at URLRequestThrottlerEntryInterface. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 void StartImpl(Mode mode, ModeChangeCallback* callback); | 303 void StartImpl(Mode mode, ModeChangeCallback* callback); |
| 300 void ScheduleNudgeImpl( | 304 void ScheduleNudgeImpl( |
| 301 const base::TimeDelta& delay, | 305 const base::TimeDelta& delay, |
| 302 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 306 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 303 const syncable::ModelTypePayloadMap& types_with_payloads, | 307 const syncable::ModelTypePayloadMap& types_with_payloads, |
| 304 bool is_canary_job, const tracked_objects::Location& nudge_location); | 308 bool is_canary_job, const tracked_objects::Location& nudge_location); |
| 305 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, | 309 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, |
| 306 const std::vector<ModelSafeWorker*>& workers, | 310 const std::vector<ModelSafeWorker*>& workers, |
| 307 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | 311 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| 308 void ScheduleClearUserDataImpl(); | 312 void ScheduleClearUserDataImpl(); |
| 309 void ScheduleCleanupDisabledTypesImpl(); | |
| 310 | 313 |
| 311 // Returns true if the client is currently in exponential backoff. | 314 // Returns true if the client is currently in exponential backoff. |
| 312 bool IsBackingOff() const; | 315 bool IsBackingOff() const; |
| 313 | 316 |
| 314 // Helper to signal all listeners registered with |session_context_|. | 317 // Helper to signal all listeners registered with |session_context_|. |
| 315 void Notify(SyncEngineEvent::EventCause cause); | 318 void Notify(SyncEngineEvent::EventCause cause); |
| 316 | 319 |
| 317 // Callback to change backoff state. | 320 // Callback to change backoff state. |
| 318 void DoCanaryJob(); | 321 void DoCanaryJob(); |
| 319 void Unthrottle(); | 322 void Unthrottle(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 scoped_ptr<Syncer> syncer_; | 396 scoped_ptr<Syncer> syncer_; |
| 394 | 397 |
| 395 scoped_ptr<sessions::SyncSessionContext> session_context_; | 398 scoped_ptr<sessions::SyncSessionContext> session_context_; |
| 396 | 399 |
| 397 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 400 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
| 398 }; | 401 }; |
| 399 | 402 |
| 400 } // namespace browser_sync | 403 } // namespace browser_sync |
| 401 | 404 |
| 402 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 405 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |