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

Unified Diff: chrome/browser/chromeos/drive/sync/entry_update_performer.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/sync/entry_update_performer.cc
diff --git a/chrome/browser/chromeos/drive/sync/entry_update_performer.cc b/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
index c1410f16f12d48dc97fabaa0af5b5551f04eb265..48c4ee668b8d3974dca28c85e6580044f05f6724 100644
--- a/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
+++ b/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
@@ -55,7 +55,9 @@ FileError PrepareUpdate(ResourceMetadata* metadata,
return FILE_ERROR_NOT_FOUND;
FileCacheEntry cache_entry;
- cache->GetCacheEntry(local_id, &cache_entry);
+ error = cache->GetCacheEntry(local_id, &cache_entry);
+ if (error != FILE_ERROR_OK && error != FILE_ERROR_NOT_FOUND)
+ return error;
if (!local_state->entry.file_info().is_directory() &&
!cache_entry.is_present() && local_state->entry.resource_id().empty()) {
// Locally created file with no cache file, store an empty file.
@@ -66,8 +68,9 @@ FileError PrepareUpdate(ResourceMetadata* metadata,
FileCache::FILE_OPERATION_MOVE);
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;
}
// Check if content update is needed or not.
@@ -77,8 +80,9 @@ FileError PrepareUpdate(ResourceMetadata* metadata,
error = cache->UpdateMd5(local_id);
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;
}
if (cache_entry.md5() == local_state->entry.file_specific_info().md5()) {
@@ -161,8 +165,10 @@ FileError FinishUpdate(ResourceMetadata* metadata,
// Clear dirty bit unless the file has been edited during update.
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() &&
cache_entry.md5() == entry.file_specific_info().md5()) {
error = cache->ClearDirty(local_id);
if (error != FILE_ERROR_OK)

Powered by Google App Engine
This is Rietveld 408576698