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

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

Issue 59363002: drive: Simplify GetFileForSavingOperation 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/get_file_for_saving_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/get_file_for_saving_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc b/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc
index e1964a4efb951d6b0b1ce8dc0a03e0e7f2724ec7..12d33d84b878e838c6e010c37c668adea377fb31 100644
--- a/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.cc
@@ -18,21 +18,6 @@ using content::BrowserThread;
namespace drive {
namespace file_system {
-namespace {
-
-// Marks the cache entry as dirty.
-FileError MarkDirty(internal::ResourceMetadata* metadata,
- internal::FileCache* cache,
- const std::string& resource_id,
- std::string* local_id) {
- FileError error = metadata->GetIdByResourceId(resource_id, local_id);
- if (error != FILE_ERROR_OK)
- return error;
- return cache->MarkDirty(*local_id);
-}
-
-} // namespace
-
GetFileForSavingOperation::GetFileForSavingOperation(
base::SequencedTaskRunner* blocking_task_runner,
OperationObserver* observer,
@@ -113,24 +98,23 @@ void GetFileForSavingOperation::GetFileForSavingAfterDownload(
return;
}
- const std::string& resource_id = entry->resource_id();
- std::string* local_id = new std::string;
+ const std::string& local_id = entry->local_id();
base::PostTaskAndReplyWithResult(
blocking_task_runner_.get(),
FROM_HERE,
- base::Bind(&MarkDirty, metadata_, cache_, resource_id, local_id),
+ base::Bind(&internal::FileCache::MarkDirty,
+ base::Unretained(cache_),
+ local_id),
base::Bind(&GetFileForSavingOperation::GetFileForSavingAfterMarkDirty,
weak_ptr_factory_.GetWeakPtr(),
callback,
cache_path,
- base::Owned(local_id),
base::Passed(&entry)));
}
void GetFileForSavingOperation::GetFileForSavingAfterMarkDirty(
const GetFileCallback& callback,
const base::FilePath& cache_path,
- const std::string* local_id,
scoped_ptr<ResourceEntry> entry,
FileError error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -141,6 +125,7 @@ void GetFileForSavingOperation::GetFileForSavingAfterMarkDirty(
return;
}
+ const std::string& local_id = entry->local_id();
file_write_watcher_->StartWatch(
cache_path,
base::Bind(&GetFileForSavingOperation::GetFileForSavingAfterWatch,
@@ -150,7 +135,7 @@ void GetFileForSavingOperation::GetFileForSavingAfterMarkDirty(
base::Passed(&entry)),
base::Bind(&GetFileForSavingOperation::OnWriteEvent,
weak_ptr_factory_.GetWeakPtr(),
- *local_id));
+ local_id));
}
void GetFileForSavingOperation::GetFileForSavingAfterWatch(
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/get_file_for_saving_operation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698