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

Unified Diff: chrome/browser/chromeos/drive/file_cache.cc

Issue 18068009: drive: Repect argument MD5 in FileCache::MarkDirty (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | 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_cache.cc
diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc
index 2fbce2179750379950e7393a90a7295bcb260440..f0897085fdc67d4322a4c326d4b8f06fa79dbab5 100644
--- a/chrome/browser/chromeos/drive/file_cache.cc
+++ b/chrome/browser/chromeos/drive/file_cache.cc
@@ -496,7 +496,7 @@ FileError FileCache::MarkDirty(const std::string& resource_id,
// Marking a file dirty means its entry and actual file blob must exist in
// cache.
FileCacheEntry cache_entry;
- if (!storage_->GetCacheEntry(resource_id, &cache_entry) ||
+ if (!GetCacheEntry(resource_id, md5, &cache_entry) ||
!cache_entry.is_present()) {
LOG(WARNING) << "Can't mark dirty a file that wasn't cached: res_id="
<< resource_id
@@ -508,17 +508,16 @@ FileError FileCache::MarkDirty(const std::string& resource_id,
return FILE_ERROR_OK;
// Get the current path of the file in cache.
- base::FilePath source_path = GetCacheFilePath(resource_id, md5,
+ base::FilePath source_path = GetCacheFilePath(resource_id, cache_entry.md5(),
CACHED_FILE_FROM_SERVER);
// Determine destination path.
base::FilePath cache_file_path = GetCacheFilePath(
- resource_id, md5, CACHED_FILE_LOCALLY_MODIFIED);
+ resource_id, cache_entry.md5(), CACHED_FILE_LOCALLY_MODIFIED);
if (!MoveFile(source_path, cache_file_path))
return FILE_ERROR_FAILED;
// Now that file operations have completed, update metadata.
- cache_entry.set_md5(md5);
cache_entry.set_is_dirty(true);
storage_->PutCacheEntry(resource_id, cache_entry);
return FILE_ERROR_OK;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698