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

Unified Diff: chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc

Issue 446793002: [SyncFS] Unconditionally demote remote file trackers on remote-to-local sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 4 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: chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
index ad45abc2585d930ceaf72c60669e21c0b8b9133d..d9d06b2f7f358a27f10585b02524b168005d44d7 100644
--- a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
+++ b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
@@ -129,6 +129,7 @@ void RemoteToLocalSyncer::RunExclusive(scoped_ptr<SyncTaskToken> token) {
dirty_tracker_.get())) {
token->RecordLog(base::StringPrintf(
"Start: tracker_id=%" PRId64, dirty_tracker_->tracker_id()));
+ metadata_database()->LowerTrackerPriority(dirty_tracker_->tracker_id());
ResolveRemoteChange(token.Pass());
return;
}
@@ -344,6 +345,8 @@ void RemoteToLocalSyncer::DidUpdateDatabaseForRemoteMetadata(
return;
}
+ metadata_database()->PromoteDemotedTracker(dirty_tracker_->tracker_id());
+
// Do not update |dirty_tracker_|.
SyncCompleted(token.Pass(), SYNC_STATUS_RETRY);
}
@@ -383,9 +386,7 @@ void RemoteToLocalSyncer::DidPrepareForAddOrUpdateFile(
// Got a remote regular file modification for existing local folder.
// Our policy prioritize folders in this case.
- // Lower the priority of the tracker to prevent repeated remote sync to the
- // same tracker, and let local-to-remote sync phase process this change.
- metadata_database()->LowerTrackerPriority(dirty_tracker_->tracker_id());
+ // Let local-to-remote sync phase process this change.
remote_change_processor()->RecordFakeLocalChange(
url_,
FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
@@ -397,10 +398,6 @@ void RemoteToLocalSyncer::DidPrepareForAddOrUpdateFile(
DCHECK(local_changes_->back().IsAddOrUpdate());
// Conflict case.
// Do nothing for the change now, and handle this in LocalToRemoteSync phase.
-
- // Lower the priority of the tracker to prevent repeated remote sync to the
- // same tracker.
- metadata_database()->LowerTrackerPriority(dirty_tracker_->tracker_id());
SyncCompleted(token.Pass(), SYNC_STATUS_RETRY);
}
@@ -728,10 +725,6 @@ void RemoteToLocalSyncer::DidDownloadFile(scoped_ptr<SyncTaskToken> token,
if (md5 != remote_metadata_->details().md5()) {
// File has been modified since last metadata retrieval.
-
- // Lower the priority of the tracker to prevent repeated remote sync to the
- // same tracker.
- metadata_database()->LowerTrackerPriority(dirty_tracker_->tracker_id());
SyncCompleted(token.Pass(), SYNC_STATUS_RETRY);
return;
}
@@ -747,8 +740,6 @@ void RemoteToLocalSyncer::DidDownloadFile(scoped_ptr<SyncTaskToken> token,
void RemoteToLocalSyncer::DidApplyDownload(scoped_ptr<SyncTaskToken> token,
webkit_blob::ScopedFile,
SyncStatusCode status) {
- if (status != SYNC_STATUS_OK)
- metadata_database()->LowerTrackerPriority(dirty_tracker_->tracker_id());
SyncCompleted(token.Pass(), status);
}

Powered by Google App Engine
This is Rietveld 408576698