| 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> |
| 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/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/task.h" | 18 #include "base/task.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "chrome/browser/sync/engine/configure_reason.h" | |
| 22 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| 23 #include "chrome/browser/sync/engine/nudge_source.h" | 22 #include "chrome/browser/sync/engine/nudge_source.h" |
| 24 #include "chrome/browser/sync/engine/polling_constants.h" | 23 #include "chrome/browser/sync/engine/polling_constants.h" |
| 25 #include "chrome/browser/sync/engine/syncer.h" | 24 #include "chrome/browser/sync/engine/syncer.h" |
| 26 #include "chrome/browser/sync/sessions/sync_session_context.h" | 25 #include "chrome/browser/sync/sessions/sync_session_context.h" |
| 27 #include "chrome/browser/sync/sessions/sync_session.h" | 26 #include "chrome/browser/sync/sessions/sync_session.h" |
| 28 #include "chrome/browser/sync/syncable/model_type_payload_map.h" | 27 #include "chrome/browser/sync/syncable/model_type_payload_map.h" |
| 29 | 28 |
| 30 class MessageLoop; | 29 class MessageLoop; |
| 31 | 30 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void Stop(); | 82 void Stop(); |
| 84 | 83 |
| 85 // The meat and potatoes. | 84 // The meat and potatoes. |
| 86 void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, | 85 void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, |
| 87 const syncable::ModelTypeBitSet& types, | 86 const syncable::ModelTypeBitSet& types, |
| 88 const tracked_objects::Location& nudge_location); | 87 const tracked_objects::Location& nudge_location); |
| 89 void ScheduleNudgeWithPayloads( | 88 void ScheduleNudgeWithPayloads( |
| 90 const base::TimeDelta& delay, NudgeSource source, | 89 const base::TimeDelta& delay, NudgeSource source, |
| 91 const syncable::ModelTypePayloadMap& types_with_payloads, | 90 const syncable::ModelTypePayloadMap& types_with_payloads, |
| 92 const tracked_objects::Location& nudge_location); | 91 const tracked_objects::Location& nudge_location); |
| 93 void ScheduleConfig(const syncable::ModelTypeBitSet& types, | 92 |
| 94 sync_api::ConfigureReason reason); | 93 // Note: The source argument of this function must come from the subset of |
| 94 // GetUpdatesCallerInfo values related to configurations. |
| 95 void ScheduleConfig( |
| 96 const syncable::ModelTypeBitSet& types, |
| 97 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
| 98 |
| 95 void ScheduleClearUserData(); | 99 void ScheduleClearUserData(); |
| 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|. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 scoped_ptr<Syncer> syncer_; | 397 scoped_ptr<Syncer> syncer_; |
| 394 | 398 |
| 395 scoped_ptr<sessions::SyncSessionContext> session_context_; | 399 scoped_ptr<sessions::SyncSessionContext> session_context_; |
| 396 | 400 |
| 397 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); | 401 DISALLOW_COPY_AND_ASSIGN(SyncScheduler); |
| 398 }; | 402 }; |
| 399 | 403 |
| 400 } // namespace browser_sync | 404 } // namespace browser_sync |
| 401 | 405 |
| 402 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ | 406 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNC_SCHEDULER_H_ |
| OLD | NEW |