| 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 dbc018a57d77f0c66ca91df2eec56360bf1ee549..47954b2e042b6857bf81f9a7aa84298bce14f194 100644
|
| --- a/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
|
| +++ b/chrome/browser/chromeos/drive/sync/entry_update_performer.cc
|
| @@ -54,12 +54,9 @@ FileError PrepareUpdate(ResourceMetadata* metadata,
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
|
|
| - FileCacheEntry 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()) {
|
| + !local_state->entry.file_specific_info().cache_state().is_present() &&
|
| + local_state->entry.resource_id().empty()) {
|
| // Locally created file with no cache file, store an empty file.
|
| base::FilePath empty_file;
|
| if (!base::CreateTemporaryFile(&empty_file))
|
| @@ -68,24 +65,26 @@ FileError PrepareUpdate(ResourceMetadata* metadata,
|
| FileCache::FILE_OPERATION_MOVE);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
| - error = cache->GetCacheEntry(local_id, &cache_entry);
|
| + error = metadata->GetResourceEntryById(local_id, &local_state->entry);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
| }
|
|
|
| // Check if content update is needed or not.
|
| - if (cache_entry.is_dirty() && !cache->IsOpenedForWrite(local_id)) {
|
| + if (local_state->entry.file_specific_info().cache_state().is_dirty() &&
|
| + !cache->IsOpenedForWrite(local_id)) {
|
| // Update cache entry's MD5 if needed.
|
| - if (cache_entry.md5().empty()) {
|
| + if (local_state->entry.file_specific_info().cache_state().md5().empty()) {
|
| error = cache->UpdateMd5(local_id);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
| - error = cache->GetCacheEntry(local_id, &cache_entry);
|
| + error = metadata->GetResourceEntryById(local_id, &local_state->entry);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
| }
|
|
|
| - if (cache_entry.md5() == local_state->entry.file_specific_info().md5()) {
|
| + if (local_state->entry.file_specific_info().cache_state().md5() ==
|
| + local_state->entry.file_specific_info().md5()) {
|
| error = cache->ClearDirty(local_id);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
| @@ -166,12 +165,9 @@ FileError FinishUpdate(ResourceMetadata* metadata,
|
| return error;
|
|
|
| // Clear dirty bit unless the file has been edited during update.
|
| - FileCacheEntry cache_entry;
|
| - 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()) {
|
| + if (entry.file_specific_info().cache_state().is_dirty() &&
|
| + entry.file_specific_info().cache_state().md5() ==
|
| + entry.file_specific_info().md5()) {
|
| error = cache->ClearDirty(local_id);
|
| if (error != FILE_ERROR_OK)
|
| return error;
|
|
|