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

Unified Diff: chrome/browser/chromeos/drive/file_system/copy_operation.cc

Issue 16628003: drive: Remove FileCacheObserver::OnCacheCommitted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PinAndUnpin Created 7 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: chrome/browser/chromeos/drive/file_system/copy_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc
index 2df946473d6f73dc430b2c261cbaaf1968df4a75..8978e0e96de32869553ad46e304b015381ce0eb8 100644
--- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc
@@ -37,6 +37,18 @@ FileError CopyLocalFileOnBlockingPool(
FILE_ERROR_OK : FILE_ERROR_FAILED;
}
+// Stores a file to the cache and mark it dirty.
+FileError StoreAndMarkDirty(internal::FileCache* cache,
+ const std::string& resource_id,
+ const std::string& md5,
+ const base::FilePath& local_file_path) {
+ FileError error = cache->Store(resource_id, md5, local_file_path,
+ internal::FileCache::FILE_OPERATION_COPY);
+ if (error != FILE_ERROR_OK)
+ return error;
+ return cache->MarkDirty(resource_id, md5);
+}
+
} // namespace
CopyOperation::CopyOperation(base::SequencedTaskRunner* blocking_task_runner,
@@ -194,12 +206,28 @@ void CopyOperation::ScheduleTransferRegularFileAfterGetResourceEntry(
return;
}
- cache_->StoreLocallyModifiedOnUIThread(
- entry->resource_id(),
- entry->file_specific_info().md5(),
- local_file_path,
- internal::FileCache::FILE_OPERATION_COPY,
- callback);
+ ResourceEntry* entry_ptr = entry.get();
+ base::PostTaskAndReplyWithResult(
+ blocking_task_runner_,
+ FROM_HERE,
+ base::Bind(&StoreAndMarkDirty,
+ cache_,
+ entry_ptr->resource_id(),
+ entry_ptr->file_specific_info().md5(),
+ local_file_path),
+ base::Bind(&CopyOperation::ScheduleTransferRegularFileAfterStore,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Passed(&entry),
+ callback));
+}
+
+void CopyOperation::ScheduleTransferRegularFileAfterStore(
+ scoped_ptr<ResourceEntry> entry,
+ const FileOperationCallback& callback,
+ FileError error) {
+ if (error == FILE_ERROR_OK)
+ observer_->OnCacheFileUploadNeededByOperation(entry->resource_id());
+ callback.Run(error);
}
void CopyOperation::CopyHostedDocumentToDirectory(

Powered by Google App Engine
This is Rietveld 408576698