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

Side by Side Diff: components/drive/remove_stale_cache_files.cc

Issue 1314803004: Move chrome/browser/chromeos/drive/file_system.cc (+deps) into components/drive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/drive/remove_stale_cache_files.h" 5 #include "components/drive/remove_stale_cache_files.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/drive/drive.pb.h" 8 #include "components/drive/drive.pb.h"
9 #include "components/drive/file_cache.h" 9 #include "components/drive/file_cache.h"
10 #include "components/drive/resource_metadata.h" 10 #include "components/drive/resource_metadata.h"
11 11
12 namespace drive { 12 namespace drive {
13 namespace internal { 13 namespace internal {
14 14
15 void RemoveStaleCacheFiles(FileCache* cache, 15 void RemoveStaleCacheFiles(FileCache* cache,
16 ResourceMetadata* resource_metadata) { 16 ResourceMetadata* resource_metadata) {
17 scoped_ptr<ResourceMetadata::Iterator> it = resource_metadata->GetIterator(); 17 scoped_ptr<ResourceMetadata::Iterator> it = resource_metadata->GetIterator();
18 for (; !it->IsAtEnd(); it->Advance()) { 18 for (; !it->IsAtEnd(); it->Advance()) {
19 const ResourceEntry& entry = it->GetValue(); 19 const ResourceEntry& entry = it->GetValue();
20 const FileCacheEntry& cache_state = 20 const FileCacheEntry& cache_state =
21 entry.file_specific_info().cache_state(); 21 entry.file_specific_info().cache_state();
22 // Stale = not dirty but the MD5 does not match. 22 // Stale = not dirty but the MD5 does not match.
23 if (!cache_state.is_dirty() && 23 if (!cache_state.is_dirty() &&
24 cache_state.md5() != entry.file_specific_info().md5()) { 24 cache_state.md5() != entry.file_specific_info().md5()) {
25 FileError error = cache->Remove(it->GetID()); 25 FileError error = cache->Remove(it->GetID());
26 LOG_IF(WARNING, error != FILE_ERROR_OK) 26 LOG_IF(WARNING, error != FILE_ERROR_OK)
27 << "Failed to remove a stale cache file. resource_id: " 27 << "Failed to remove a stale cache file. resource_id: "
28 << it->GetID(); 28 << it->GetID();
29 } 29 }
30 } 30 }
31 } 31 }
32 32
33 } // namespace internal 33 } // namespace internal
34 } // namespace drive 34 } // namespace drive
OLDNEW
« no previous file with comments | « components/drive/remove_stale_cache_files.h ('k') | components/drive/remove_stale_cache_files_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698