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

Unified Diff: chrome/browser/chromeos/drive/file_system.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.cc
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index fb7e4cc5f0be2a943b4e71ec6d1283c96ceec45c..ccceb1ec3f77f71a150e8bc215317f70db36bb3a 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -64,8 +64,11 @@ FileError GetLocallyStoredResourceEntry(
// When cache is not found, use the original resource entry as is.
FileCacheEntry cache_entry;
- if (!cache->GetCacheEntry(local_id, &cache_entry))
+ error = cache->GetCacheEntry(local_id, &cache_entry);
+ if (error == FILE_ERROR_NOT_FOUND)
return FILE_ERROR_OK;
+ if (error != FILE_ERROR_OK)
+ return error;
// When cache is non-dirty and obsolete (old hash), use the original entry.
if (!cache_entry.is_dirty() &&
@@ -155,13 +158,14 @@ void RunMarkMountedCallback(const MarkMountedCallback& callback,
}
// Used to implement GetCacheEntry.
-bool GetCacheEntryInternal(internal::ResourceMetadata* resource_metadata,
- internal::FileCache* cache,
- const base::FilePath& drive_file_path,
- FileCacheEntry* cache_entry) {
+FileError GetCacheEntryInternal(internal::ResourceMetadata* resource_metadata,
+ internal::FileCache* cache,
+ const base::FilePath& drive_file_path,
+ FileCacheEntry* cache_entry) {
std::string id;
- if (resource_metadata->GetIdByPath(drive_file_path, &id) != FILE_ERROR_OK)
- return false;
+ FileError error = resource_metadata->GetIdByPath(drive_file_path, &id);
+ if (error != FILE_ERROR_OK)
+ return error;
return cache->GetCacheEntry(id, cache_entry);
}
@@ -169,9 +173,9 @@ bool GetCacheEntryInternal(internal::ResourceMetadata* resource_metadata,
// Runs the callback with arguments.
void RunGetCacheEntryCallback(const GetCacheEntryCallback& callback,
const FileCacheEntry* cache_entry,
- bool success) {
+ FileError error) {
DCHECK(!callback.is_null());
- callback.Run(success, *cache_entry);
+ callback.Run(error, *cache_entry);
}
// Callback for ResourceMetadata::GetLargestChangestamp.
« no previous file with comments | « chrome/browser/chromeos/drive/file_cache_unittest.cc ('k') | chrome/browser/chromeos/drive/file_system/copy_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698