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

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

Issue 59443002: drive: Simplify TruncateOperation with ResourceEntry::local_id (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/chromeos/drive/file_system/truncate_operation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_system/truncate_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
index 7b81350341119e4baba8ea79b723ae0ab5446f56..c5c7d140fa12caf94dcceab0ca52e7a62444ca9e 100644
--- a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
@@ -29,19 +29,13 @@ namespace {
// then marks the resource is dirty on |cache|.
FileError TruncateOnBlockingPool(internal::ResourceMetadata* metadata,
internal::FileCache* cache,
- const std::string& resource_id,
+ const std::string& local_id,
const base::FilePath& local_cache_path,
- int64 length,
- std::string* local_id) {
+ int64 length) {
DCHECK(metadata);
DCHECK(cache);
- DCHECK(local_id);
-
- FileError error = metadata->GetIdByResourceId(resource_id, local_id);
- if (error != FILE_ERROR_OK)
- return error;
- error = cache->MarkDirty(*local_id);
+ FileError error = cache->MarkDirty(local_id);
if (error != FILE_ERROR_OK)
return error;
@@ -133,26 +127,24 @@ void TruncateOperation::TruncateAfterEnsureFileDownloadedByPath(
return;
}
- std::string* local_id = new std::string;
base::PostTaskAndReplyWithResult(
blocking_task_runner_.get(),
FROM_HERE,
base::Bind(&TruncateOnBlockingPool,
- metadata_, cache_, entry->resource_id(), local_file_path,
- length, local_id),
+ metadata_, cache_, entry->local_id(), local_file_path, length),
base::Bind(
&TruncateOperation::TruncateAfterTruncateOnBlockingPool,
- weak_ptr_factory_.GetWeakPtr(), base::Owned(local_id), callback));
+ weak_ptr_factory_.GetWeakPtr(), entry->local_id(), callback));
}
void TruncateOperation::TruncateAfterTruncateOnBlockingPool(
- const std::string* local_id,
+ const std::string& local_id,
const FileOperationCallback& callback,
FileError error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- observer_->OnCacheFileUploadNeededByOperation(*local_id);
+ observer_->OnCacheFileUploadNeededByOperation(local_id);
callback.Run(error);
}
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/truncate_operation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698