diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 00:56:16 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 00:56:16 +0000 |
commit | 92009f8d856c77a8c61c2c7de994a07f8d70d2b5 (patch) | |
tree | 99fc8f0125d8f93a6933ce95bdb18d3ae1a2a42c /chrome/browser/sync/profile_sync_service_harness.cc | |
parent | 67e167b8fa30e7a024f7697da9d4a87279baf4ac (diff) | |
download | chromium_src-92009f8d856c77a8c61c2c7de994a07f8d70d2b5.zip chromium_src-92009f8d856c77a8c61c2c7de994a07f8d70d2b5.tar.gz chromium_src-92009f8d856c77a8c61c2c7de994a07f8d70d2b5.tar.bz2 |
[Sync] Support for non-blocking conflicts and encryption conflicts.
This patch introduces the notion of non-blocking conflicts. These are conflicts that do not result in the
syncer getting stuck. They affect the HasConflictingUpdates status call, so we attempt to reapply updates
when they occur, but they are not passed to the conflict resolver, and hence do not result in the syncer being stuck. All cases where we have a conflict due to encryption/decryption result in a new
ENCRYPTION_CONFLICT, which are treated as nonblocking conflicts.
Updated sync's protocol_version to 27 so the server can tell which clients understand encryption.
Also, due to this change, it's more likely that local/server changes will be overwritten in the conflict
resolver (since encryption conflicts are kept as unapplied while they can't be decrypted). Added
counters for how often this happens, which will appear on about:sync, and filed follow up bug
crbug.com/76596.
BUG=59242
TEST=new session sync_integration tests, modified apply_updates_command unit tests
Review URL: http://codereview.chromium.org/6714002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_service_harness.cc')
-rw-r--r-- | chrome/browser/sync/profile_sync_service_harness.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index fdbbe01..2f6007e 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -278,11 +278,14 @@ bool ProfileSyncServiceHarness::RunStateChangeMachine() { break; } case WAITING_FOR_ENCRYPTION: { + // If the type whose encryption we are waiting for is now complete, there + // is nothing to do. Encryption can take multiple sync cycles, but we only + // exit out if we are fully synced or can't connect to the server. LogClientInfo("WAITING_FOR_ENCRYPTION", 1); - if (IsTypeEncrypted(waiting_for_encryption_type_)) { - // Encryption is complete for the type we are waiting on. + if (IsSynced() && IsTypeEncrypted(waiting_for_encryption_type_)) SignalStateCompleteWithNextState(FULLY_SYNCED); - } + else if (!GetStatus().server_reachable) + SignalStateCompleteWithNextState(SERVER_UNREACHABLE); break; } case WAITING_FOR_SYNC_CONFIGURATION: { @@ -518,7 +521,7 @@ bool ProfileSyncServiceHarness::IsSynced() { // TODO(rsimha): Remove additional checks of snap->has_more_to_sync and // snap->unsynced_count once http://crbug.com/48989 is fixed. return (snap && - snap->num_conflicting_updates == 0 && // We can decrypt everything. + snap->num_blocking_conflicting_updates == 0 && ServiceIsPushingChanges() && GetStatus().notifications_enabled && !service()->HasUnsyncedItems() && @@ -658,6 +661,8 @@ void ProfileSyncServiceHarness::LogClientInfo(const std::string& message, << snap->syncer_status.num_updates_downloaded_total << ", has_more_to_sync: " << snap->has_more_to_sync << ", unsynced_count: " << snap->unsynced_count + << ", num_blocking_conflicting_updates: " + << snap->num_blocking_conflicting_updates << ", num_conflicting_updates: " << snap->num_conflicting_updates << ", has_unsynced_items: " @@ -695,8 +700,13 @@ bool ProfileSyncServiceHarness::EnableEncryptionForType( service_->EncryptDataTypes(encrypted_types); // Wait some time to let the enryption finish. + return WaitForTypeEncryption(type); +} + +bool ProfileSyncServiceHarness::WaitForTypeEncryption( + syncable::ModelType type) { + // Wait some time to let the enryption finish. std::string reason = "Waiting for encryption."; - DCHECK_EQ(FULLY_SYNCED, wait_state_); wait_state_ = WAITING_FOR_ENCRYPTION; waiting_for_encryption_type_ = type; if (!AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason)) { @@ -705,7 +715,6 @@ bool ProfileSyncServiceHarness::EnableEncryptionForType( << " seconds."; return false; } - return IsTypeEncrypted(type); } |