Skip to content

Commit

Permalink
[Sync] Allow enabling partial sets of types instead of blocking
Browse files Browse the repository at this point in the history
Blocking the datatype manager when datatypes fail to start is a sign of
encryption issues, but is not fatal to sync. Therefore, it makes more sense
to sync what we can (particularly so we can receive birthday updates), while
marking those types with encryption problems as failed.

To accomplish this we move all automatic reconfiguration logic into the
data type manager itself, and add support for delayed association by
unapplying all types with cryptographer errors. This also lays the
groundwork for delayed association when a transaction version discrepancy
is detected.

BUG=238712

Review URL: https://chromiumcodereview.appspot.com/15013004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204695 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
zea@chromium.org committed Jun 7, 2013
1 parent 3c372a1 commit 1f51ad9
Show file tree
Hide file tree
Showing 40 changed files with 794 additions and 404 deletions.
1 change: 1 addition & 0 deletions chrome/browser/sync/backend_migrator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SyncBackendMigratorTest : public testing::Test {
status,
requested_types,
errors,
syncer::ModelTypeSet(),
syncer::ModelTypeSet());
migrator_->OnConfigureDone(result);
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/sync/glue/backend_data_type_configurer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class BackendDataTypeConfigurer {
// Data of such types is left as it is, no
// downloading or purging.
DISABLED, // Not syncing. Disabled by user.
FAILED, // Not syncing due to unrecoverable error.
FATAL, // Not syncing due to unrecoverable error.
CRYPTO, // Not syncing due to a cryptographer error.
};
typedef std::map<syncer::ModelType, DataTypeConfigState>
DataTypeConfigStateMap;
Expand Down
8 changes: 5 additions & 3 deletions chrome/browser/sync/glue/data_type_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ DataTypeManager::ConfigureResult::ConfigureResult(
ConfigureStatus status,
syncer::ModelTypeSet requested_types,
std::map<syncer::ModelType, syncer::SyncError> failed_data_types,
syncer::ModelTypeSet waiting_to_start)
syncer::ModelTypeSet waiting_to_start,
syncer::ModelTypeSet needs_crypto)
: status(status),
requested_types(requested_types),
failed_data_types(failed_data_types),
waiting_to_start(waiting_to_start) {
if (!failed_data_types.empty()) {
waiting_to_start(waiting_to_start),
needs_crypto(needs_crypto) {
if (!failed_data_types.empty() || !needs_crypto.Empty()) {
DCHECK_NE(OK, status);
}
}
Expand Down
12 changes: 7 additions & 5 deletions chrome/browser/sync/glue/data_type_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class DataTypeManager {
// types.

CONFIGURING, // Data types are being started.
BLOCKED, // We can't move forward with configuration because some
// external action must take place (i.e. passphrase).
RETRYING, // Retrying a pending reconfiguration.

CONFIGURED, // All enabled data types are running.
STOPPING // Data types are being stopped.
Expand All @@ -42,8 +41,6 @@ class DataTypeManager {
PARTIAL_SUCCESS, // Some data types had an error while starting up.
ABORTED, // Start was aborted by calling Stop() before
// all types were started.
CONFIGURE_BLOCKED, // Configuration was blocked due to missing
// passphrase.
UNRECOVERABLE_ERROR // We got an unrecoverable error during startup.
};

Expand All @@ -56,7 +53,8 @@ class DataTypeManager {
syncer::ModelTypeSet requested_types,
std::map<syncer::ModelType, syncer::SyncError>
failed_data_types,
syncer::ModelTypeSet waiting_to_start);
syncer::ModelTypeSet waiting_to_start,
syncer::ModelTypeSet needs_crypto);
~ConfigureResult();
ConfigureStatus status;
syncer::ModelTypeSet requested_types;
Expand All @@ -70,6 +68,10 @@ class DataTypeManager {
// background. When these types are loaded DataTypeManager will
// be informed and another configured cycle will be started.
syncer::ModelTypeSet waiting_to_start;

// Those types that are unable to start due to the cryptographer not being
// ready.
syncer::ModelTypeSet needs_crypto;
};

virtual ~DataTypeManager() {}
Expand Down
Loading

0 comments on commit 1f51ad9

Please sign in to comment.