summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/drive/sync_client.cc
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 05:51:35 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 05:51:35 +0000
commit0c53f988464cdf75b357d8726083a382595e4046 (patch)
tree2246995a0eaac7a883f5a393a70218c5f1d94a6b /chrome/browser/chromeos/drive/sync_client.cc
parented4564866a59aea6a1b8a418209e7e99f766fafd (diff)
downloadchromium_src-0c53f988464cdf75b357d8726083a382595e4046.zip
chromium_src-0c53f988464cdf75b357d8726083a382595e4046.tar.gz
chromium_src-0c53f988464cdf75b357d8726083a382595e4046.tar.bz2
drive: Remove FileCache::GetIterator
RemoveStaleCacheFiles's role is changed as FileCacheEntry will be always accompanied by ResourceEntry in the new world. BUG=275271 TEST=unit_tests Review URL: https://codereview.chromium.org/282753009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/drive/sync_client.cc')
-rw-r--r--chrome/browser/chromeos/drive/sync_client.cc21
1 files changed, 8 insertions, 13 deletions
diff --git a/chrome/browser/chromeos/drive/sync_client.cc b/chrome/browser/chromeos/drive/sync_client.cc
index 23ba95e..a785201 100644
--- a/chrome/browser/chromeos/drive/sync_client.cc
+++ b/chrome/browser/chromeos/drive/sync_client.cc
@@ -88,28 +88,23 @@ void CollectBacklog(ResourceMetadata* metadata,
void CheckExistingPinnedFiles(ResourceMetadata* metadata,
FileCache* cache,
std::vector<std::string>* local_ids) {
- scoped_ptr<FileCache::Iterator> it = cache->GetIterator();
+ scoped_ptr<ResourceMetadata::Iterator> it = metadata->GetIterator();
for (; !it->IsAtEnd(); it->Advance()) {
- const FileCacheEntry& cache_entry = it->GetValue();
+ const ResourceEntry& entry = it->GetValue();
+ const FileCacheEntry& cache_state =
+ entry.file_specific_info().cache_state();
const std::string& local_id = it->GetID();
- if (!cache_entry.is_pinned() || !cache_entry.is_present())
- continue;
-
- ResourceEntry entry;
- FileError error = metadata->GetResourceEntryById(local_id, &entry);
- if (error != FILE_ERROR_OK) {
- LOG(WARNING) << "Entry not found: " << local_id;
+ if (!cache_state.is_pinned() || !cache_state.is_present())
continue;
- }
// If MD5s don't match, it indicates the local cache file is stale, unless
// the file is dirty (the MD5 is "local"). We should never re-fetch the
// file when we have a locally modified version.
- if (entry.file_specific_info().md5() == cache_entry.md5() ||
- cache_entry.is_dirty())
+ if (entry.file_specific_info().md5() == cache_state.md5() ||
+ cache_state.is_dirty())
continue;
- error = cache->Remove(local_id);
+ FileError error = cache->Remove(local_id);
if (error != FILE_ERROR_OK) {
LOG(WARNING) << "Failed to remove cache entry: " << local_id;
continue;