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

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

Issue 276313002: drive: Change FileCache::GetCacheEntry's return type to FileError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/download_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation.cc b/chrome/browser/chromeos/drive/file_system/download_operation.cc
index 9847a3092865d7f4e469cbd0cb1615a7aea8983d..bc5a81c540f4712ce85fd7ee018fce2b03834bad 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation.cc
@@ -119,8 +119,10 @@ FileError CheckPreConditionForEnsureFileDownloaded(
}
FileCacheEntry cache_entry;
- if (!cache->GetCacheEntry(local_id, &cache_entry) ||
- !cache_entry.is_present()) { // This file has no cache file.
+ error = cache->GetCacheEntry(local_id, &cache_entry);
+ if (error != FILE_ERROR_OK && error != FILE_ERROR_NOT_FOUND)
+ return error;
+ if (!cache_entry.is_present()) { // This file has no cache file.
if (!entry->resource_id().empty()) {
// This entry exists on the server, leave |cache_file_path| empty to
// start download.
@@ -139,8 +141,9 @@ FileError CheckPreConditionForEnsureFileDownloaded(
if (error != FILE_ERROR_OK)
return error;
- if (!cache->GetCacheEntry(local_id, &cache_entry))
- return FILE_ERROR_NOT_FOUND;
+ error = cache->GetCacheEntry(local_id, &cache_entry);
+ if (error != FILE_ERROR_OK)
+ return error;
}
// Leave |cache_file_path| empty when the stored file is obsolete and has no
@@ -230,7 +233,10 @@ FileError UpdateLocalStateForDownloadFile(
// Do not overwrite locally edited file with server side contents.
FileCacheEntry cache_entry;
- if (cache->GetCacheEntry(local_id, &cache_entry) && cache_entry.is_dirty())
+ error = cache->GetCacheEntry(local_id, &cache_entry);
+ if (error != FILE_ERROR_OK && error != FILE_ERROR_NOT_FOUND)
+ return error;
+ if (cache_entry.is_dirty())
return FILE_ERROR_IN_USE;
// Here the download is completed successfully, so store it into the cache.

Powered by Google App Engine
This is Rietveld 408576698