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

Unified Diff: sync/internal_api/sync_manager.h

Issue 10483015: [Sync] Refactor sync configuration logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments + rebase Created 8 years, 6 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
Index: sync/internal_api/sync_manager.h
diff --git a/sync/internal_api/sync_manager.h b/sync/internal_api/sync_manager.h
index 04594fd75de5f7182a3e7c4ab9838ad1a54c0b64..d735f5e07ace03bb52e91df380d85cc2835a935a 100644
--- a/sync/internal_api/sync_manager.h
+++ b/sync/internal_api/sync_manager.h
@@ -26,6 +26,7 @@
#include "sync/util/weak_handle.h"
namespace browser_sync {
+struct ConfigurationParams;
class Encryptor;
struct Experiments;
class ExtensionsActivityMonitor;
@@ -431,24 +432,24 @@ class SyncManager {
// error to call this when we don't have pending keys.
void SetDecryptionPassphrase(const std::string& passphrase);
- // Puts the SyncScheduler into a mode where no normal nudge or poll traffic
- // will occur, but calls to RequestConfig will be supported. If |callback|
- // is provided, it will be invoked (from the internal SyncScheduler) when
- // the thread has changed to configuration mode.
- void StartConfigurationMode(const base::Closure& callback);
-
- // Switches the mode of operation to CONFIGURATION_MODE and
- // schedules a config task to fetch updates for |types|.
- void RequestConfig(const browser_sync::ModelSafeRoutingInfo& routing_info,
- const syncable::ModelTypeSet& types,
- sync_api::ConfigureReason reason);
-
- void RequestCleanupDisabledTypes(
- const browser_sync::ModelSafeRoutingInfo& routing_info);
-
// Request a clearing of all data on the server
void RequestClearServerData();
+ // Switches the mode of operation to CONFIGURATION_MODE and performs
+ // any configuration tasks needed as determined by the params. Once complete,
+ // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is
+ // called.
+ // |ready_task| is invoked when the configuration completes.
+ // |retry_task| is invoked if the configuration job could not immediately
+ // execute. |ready_task| will still be called when it eventually
+ // does finish.
+ void ConfigureSyncer(
+ ConfigureReason reason,
+ const syncable::ModelTypeSet& types_to_config,
+ const browser_sync::ModelSafeRoutingInfo& new_routing_info,
+ const base::Closure& ready_task,
+ const base::Closure& retry_task);
+
// Adds a listener to be notified of sync events.
// NOTE: It is OK (in fact, it's probably a good idea) to call this before
// having received OnInitializationCompleted.
@@ -542,6 +543,13 @@ class SyncManager {
static const FilePath::CharType kSyncDatabaseFilename[];
+ protected:
+ // Returns true if the configuration completed on the first attempt, false
+ // if a retry will be performed at a later time.
+ // Virtual for testing.
+ virtual bool DoConfigureSyncer(
+ const browser_sync::ConfigurationParams& params);
+
private:
FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest);

Powered by Google App Engine
This is Rietveld 408576698