Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: sync/engine/sync_scheduler.h

Issue 10689185: Revert 146262 - Revert "Revert 142517 - [Sync] Refactor sync configuration logic." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.cc ('k') | sync/engine/sync_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/sync_scheduler.h
===================================================================
--- sync/engine/sync_scheduler.h (revision 146499)
+++ sync/engine/sync_scheduler.h (working copy)
@@ -36,32 +36,6 @@
struct ServerConnectionEvent;
-struct ConfigurationParams {
- enum KeystoreKeyStatus {
- KEYSTORE_KEY_UNNECESSARY,
- KEYSTORE_KEY_NEEDED
- };
- ConfigurationParams();
- ConfigurationParams(
- const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source,
- const syncer::ModelTypeSet& types_to_download,
- const syncer::ModelSafeRoutingInfo& routing_info,
- KeystoreKeyStatus keystore_key_status,
- const base::Closure& ready_task);
- ~ConfigurationParams();
-
- // Source for the configuration.
- sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source;
- // The types that should be downloaded.
- syncer::ModelTypeSet types_to_download;
- // The new routing info (superset of types to be downloaded).
- ModelSafeRoutingInfo routing_info;
- // Whether we need to perform a GetKey command.
- KeystoreKeyStatus keystore_key_status;
- // Callback to invoke on configuration completion.
- base::Closure ready_task;
-};
-
class SyncScheduler : public sessions::SyncSession::Delegate {
public:
enum Mode {
@@ -88,16 +62,11 @@
// Start the scheduler with the given mode. If the scheduler is
// already started, switch to the given mode, although some
- // scheduled tasks from the old mode may still run.
- virtual void Start(Mode mode);
+ // scheduled tasks from the old mode may still run. If non-NULL,
+ // |callback| will be invoked when the mode has been changed to
+ // |mode|. Takes ownership of |callback|.
+ void Start(Mode mode, const base::Closure& callback);
- // Schedules the configuration task specified by |params|. Returns true if
- // the configuration task executed immediately, false if it had to be
- // scheduled for a later attempt. |params.ready_task| is invoked whenever the
- // configuration task executes.
- // Note: must already be in CONFIGURATION mode.
- virtual bool ScheduleConfiguration(const ConfigurationParams& params);
-
// Request that any running syncer task stop as soon as possible and
// cancel all scheduled tasks. This function can be called from any thread,
// and should in fact be called from a thread that isn't the sync loop to
@@ -109,13 +78,21 @@
// The meat and potatoes. Both of these methods will post a delayed task
// to attempt the actual nudge (see ScheduleNudgeImpl).
void ScheduleNudgeAsync(const base::TimeDelta& delay, NudgeSource source,
- syncer::ModelTypeSet types,
- const tracked_objects::Location& nudge_location);
+ syncer::ModelTypeSet types,
+ const tracked_objects::Location& nudge_location);
void ScheduleNudgeWithPayloadsAsync(
const base::TimeDelta& delay, NudgeSource source,
const syncer::ModelTypePayloadMap& types_with_payloads,
const tracked_objects::Location& nudge_location);
+ // Schedule a configuration cycle. May execute immediately or at a later time
+ // (depending on backoff/throttle state).
+ // Note: The source argument of this function must come from the subset of
+ // GetUpdatesCallerInfo values related to configurations.
+ void ScheduleConfiguration(
+ syncer::ModelTypeSet types,
+ sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
+
void CleanupDisabledTypes();
// Change status of notifications in the SyncSessionContext.
@@ -180,7 +157,6 @@
SyncSessionJob();
SyncSessionJob(SyncSessionJobPurpose purpose, base::TimeTicks start,
linked_ptr<sessions::SyncSession> session, bool is_canary_job,
- const ConfigurationParams& config_params,
const tracked_objects::Location& nudge_location);
~SyncSessionJob();
static const char* GetPurposeString(SyncSessionJobPurpose purpose);
@@ -189,7 +165,6 @@
base::TimeTicks scheduled_start;
linked_ptr<sessions::SyncSession> session;
bool is_canary_job;
- ConfigurationParams config_params;
// This is the location the job came from. Used for debugging.
// In case of multiple nudges getting coalesced this stores the
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.cc ('k') | sync/engine/sync_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698