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

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

Issue 437943002: [SyncFS] Remove usage of file task runner under drive_backend/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work for nits 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 f3af2980fca987fc96a5378194c61acc52611d19..2d15f01748925981505c7574691af9406b48b56d 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
@@ -689,24 +689,9 @@ void RemoteToLocalSyncer::DeleteLocalFile(const SyncStatusCallback& callback) {
void RemoteToLocalSyncer::DownloadFile(const SyncStatusCallback& callback) {
DCHECK(sync_context_->GetWorkerTaskRunner()->RunsTasksOnCurrentThread());
- base::Callback<void(webkit_blob::ScopedFile)> did_create_callback =
- base::Bind(&RemoteToLocalSyncer::DidCreateTemporaryFileForDownload,
- weak_ptr_factory_.GetWeakPtr(), callback);
+ webkit_blob::ScopedFile file = CreateTemporaryFile(
+ make_scoped_refptr(sync_context_->GetWorkerTaskRunner()));
- sync_context_->GetFileTaskRunner()->PostTask(
- FROM_HERE,
- CreateComposedFunction(
- base::Bind(&CreateTemporaryFile,
- make_scoped_refptr(sync_context_->GetFileTaskRunner())),
- RelayCallbackToTaskRunner(
- sync_context_->GetWorkerTaskRunner(), FROM_HERE,
- did_create_callback)));
-}
-
-void RemoteToLocalSyncer::DidCreateTemporaryFileForDownload(
- const SyncStatusCallback& callback,
- webkit_blob::ScopedFile file) {
- DCHECK(sync_context_->GetWorkerTaskRunner()->RunsTasksOnCurrentThread());
base::FilePath path = file.path();
drive_service()->DownloadFile(
path, remote_metadata_->file_id(),
@@ -730,24 +715,7 @@ void RemoteToLocalSyncer::DidDownloadFile(const SyncStatusCallback& callback,
}
base::FilePath path = file.path();
- base::Callback<void(const std::string&)> did_calculate_callback =
- base::Bind(&RemoteToLocalSyncer::DidCalculateMD5ForDownload,
- weak_ptr_factory_.GetWeakPtr(),
- callback, base::Passed(&file));
-
- sync_context_->GetFileTaskRunner()->PostTask(
- FROM_HERE,
- CreateComposedFunction(
- base::Bind(&drive::util::GetMd5Digest, path),
- RelayCallbackToTaskRunner(
- sync_context_->GetWorkerTaskRunner(), FROM_HERE,
- did_calculate_callback)));
-}
-
-void RemoteToLocalSyncer::DidCalculateMD5ForDownload(
- const SyncStatusCallback& callback,
- webkit_blob::ScopedFile file,
- const std::string& md5) {
+ const std::string md5 = drive::util::GetMd5Digest(path);
if (md5.empty()) {
callback.Run(SYNC_FILE_ERROR_NOT_FOUND);
return;
@@ -763,7 +731,6 @@ void RemoteToLocalSyncer::DidCalculateMD5ForDownload(
return;
}
- base::FilePath path = file.path();
remote_change_processor()->ApplyRemoteChange(
FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, SYNC_FILE_TYPE_FILE),
path, url_,

Powered by Google App Engine
This is Rietveld 408576698