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

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

Issue 98653002: [SyncFS] Update tracker on upload (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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_file_system/drive_backend/local_to_remote_syncer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
index e0dff9d9cdb8be56ace1626ec14e60e00ece3865..05cb5049b9e7071f1baaf85b6f4c612ddaa40293 100644
--- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
+++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
@@ -382,7 +382,7 @@ void LocalToRemoteSyncer::DidUploadExistingFile(
const SyncStatusCallback& callback,
google_apis::GDataErrorCode error,
const GURL&,
- scoped_ptr<google_apis::ResourceEntry>) {
+ scoped_ptr<google_apis::ResourceEntry> entry) {
if (error == google_apis::HTTP_PRECONDITION) {
// The remote file has unfetched remote change. Fetch latest metadata and
// update database with it.
@@ -392,7 +392,34 @@ void LocalToRemoteSyncer::DidUploadExistingFile(
return;
}
- callback.Run(GDataErrorCodeToSyncStatusCode(error));
+ metadata_database()->UpdateByFileResource(
+ *drive::util::ConvertResourceEntryToFileResource(*entry),
+ base::Bind(&LocalToRemoteSyncer::DidUpdateMetadataForUpload,
kinuko 2013/12/02 09:05:39 We have DidUpdateDatabaseForUpload for UploadNewFi
tzik 2013/12/02 15:30:50 Renamed. Do DidUpdateDatabaseForUpload{NewFile,Exi
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+}
+
+void LocalToRemoteSyncer::DidUpdateMetadataForUpload(
+ const SyncStatusCallback& callback,
+ SyncStatusCode status) {
+ if (status != SYNC_STATUS_OK) {
+ callback.Run(status);
+ return;
+ }
+
+ FileMetadata file;
+ bool should_success = metadata_database()->FindFileByFileID(
+ remote_file_tracker_->file_id(), &file);
+ if (should_success) {
+ NOTREACHED();
kinuko 2013/12/02 09:40:30 Hmm, I hit here in my local testing.
tzik 2013/12/02 15:30:50 ... That's broken, reversed. Fixed! Thanks!
+ callback.Run(SYNC_STATUS_FAILED);
+ return;
+ }
+
+ metadata_database()->UpdateTracker(
+ remote_file_tracker_->tracker_id(),
+ file.details(),
+ callback);
}
void LocalToRemoteSyncer::UpdateRemoteMetadata(
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698