Chromium Code Reviews| 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 void ScheduleCleanupDisabledTypes(); | |
| 96 | 97 |
| 97 // Change status of notifications in the SyncSessionContext. | 98 // Change status of notifications in the SyncSessionContext. |
| 98 void set_notifications_enabled(bool notifications_enabled); | 99 void set_notifications_enabled(bool notifications_enabled); |
| 99 | 100 |
| 100 // DDOS avoidance function. Calculates how long we should wait before trying | 101 // DDOS avoidance function. Calculates how long we should wait before trying |
| 101 // again after a failed sync attempt, where the last delay was |base_delay|. | 102 // again after a failed sync attempt, where the last delay was |base_delay|. |
| 102 // TODO(tim): Look at URLRequestThrottlerEntryInterface. | 103 // TODO(tim): Look at URLRequestThrottlerEntryInterface. |
| 103 static base::TimeDelta GetRecommendedDelay(const base::TimeDelta& base_delay); | 104 static base::TimeDelta GetRecommendedDelay(const base::TimeDelta& base_delay); |
| 104 | 105 |
| 105 // SyncSession::Delegate implementation. | 106 // SyncSession::Delegate implementation. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 // Decide on whether to CONTINUE, SAVE or DROP the job when we are in | 278 // Decide on whether to CONTINUE, SAVE or DROP the job when we are in |
| 278 // backoff mode. | 279 // backoff mode. |
| 279 JobProcessDecision DecideWhileInWaitInterval(const SyncSessionJob& job); | 280 JobProcessDecision DecideWhileInWaitInterval(const SyncSessionJob& job); |
| 280 | 281 |
| 281 // Saves the job for future execution. Note: It drops all the poll jobs. | 282 // Saves the job for future execution. Note: It drops all the poll jobs. |
| 282 void SaveJob(const SyncSessionJob& job); | 283 void SaveJob(const SyncSessionJob& job); |
| 283 | 284 |
| 284 // Coalesces the current job with the pending nudge. | 285 // Coalesces the current job with the pending nudge. |
| 285 void InitOrCoalescePendingJob(const SyncSessionJob& job); | 286 void InitOrCoalescePendingJob(const SyncSessionJob& job); |
| 286 | 287 |
| 288 // Cleans up disabled types separately from a sync cycle. | |
| 289 void CleanupDisabledTypes(); | |
|
tim (not reviewing)
2011/07/28 01:42:23
So, I get why this is here, but it confuses me to
akalin
2011/07/28 02:45:51
Done. Let's see if that works.
| |
| 290 | |
| 287 // 'Impl' here refers to real implementation of public functions, running on | 291 // 'Impl' here refers to real implementation of public functions, running on |
| 288 // |thread_|. | 292 // |thread_|. |
| 289 void StartImpl(Mode mode, ModeChangeCallback* callback); | 293 void StartImpl(Mode mode, ModeChangeCallback* callback); |
| 290 void ScheduleNudgeImpl( | 294 void ScheduleNudgeImpl( |
| 291 const base::TimeDelta& delay, | 295 const base::TimeDelta& delay, |
| 292 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 296 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
| 293 const syncable::ModelTypePayloadMap& types_with_payloads, | 297 const syncable::ModelTypePayloadMap& types_with_payloads, |
| 294 bool is_canary_job, const tracked_objects::Location& nudge_location); | 298 bool is_canary_job, const tracked_objects::Location& nudge_location); |
| 295 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, | 299 void ScheduleConfigImpl(const ModelSafeRoutingInfo& routing_info, |
| 296 const std::vector<ModelSafeWorker*>& workers, | 300 const std::vector<ModelSafeWorker*>& workers, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 scoped_ptr<Syncer> syncer_; | 383 scoped_ptr<Syncer> syncer_; |
| 380 | 384 |
| 381 scoped_ptr<sessions::SyncSessionContext> session_context_; | 385 scoped_ptr<sessions::SyncSessionContext> session_context_; |
| 382 | 386 |
| 383 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 387 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
| 384 }; | 388 }; |
| 385 | 389 |
| 386 } // namespace browser_sync | 390 } // namespace browser_sync |
| 387 | 391 |
| 388 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 392 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |