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

Unified Diff: net/disk_cache/simple/simple_index_file.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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
« no previous file with comments | « net/disk_cache/simple/simple_index.cc ('k') | net/tools/dump_cache/dump_files.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_index_file.cc
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index 53160537e60bb1840e34727d44232c6979de2a58..884522ed09f6ce50d5239f487fd2bb1590cf4ee8 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -5,6 +5,7 @@
#include "net/disk_cache/simple/simple_index_file.h"
#include "base/file_util.h"
+#include "base/files/file_enumerator.h"
#include "base/hash.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
@@ -315,7 +316,6 @@ void SimpleIndexFile::LoadIndexEntriesInternal(
// static
scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::RestoreFromDisk(
const base::FilePath& index_file_path) {
- using file_util::FileEnumerator;
LOG(INFO) << "Simple Cache Index is being restored from disk.";
file_util::Delete(index_file_path, /* recursive = */ false);
@@ -328,10 +328,10 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::RestoreFromDisk(
const int kFileSuffixLength = sizeof("_0") - 1;
const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*_[0-2]");
- FileEnumerator enumerator(index_file_path.DirName(),
- false /* recursive */,
- FileEnumerator::FILES,
- file_pattern);
+ base::FileEnumerator enumerator(index_file_path.DirName(),
+ false /* recursive */,
+ base::FileEnumerator::FILES,
+ file_pattern);
for (base::FilePath file_path = enumerator.Next(); !file_path.empty();
file_path = enumerator.Next()) {
const base::FilePath::StringType base_name = file_path.BaseName().value();
@@ -348,18 +348,17 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::RestoreFromDisk(
continue;
}
- FileEnumerator::FindInfo find_info = {};
- enumerator.GetFindInfo(&find_info);
+ base::FileEnumerator::FileInfo info = enumerator.GetInfo();
base::Time last_used_time;
#if defined(OS_POSIX)
// For POSIX systems, a last access time is available. However, it's not
// guaranteed to be more accurate than mtime. It is no worse though.
- last_used_time = base::Time::FromTimeT(find_info.stat.st_atime);
+ last_used_time = base::Time::FromTimeT(info.stat().st_atime);
#endif
if (last_used_time.is_null())
- last_used_time = FileEnumerator::GetLastModifiedTime(find_info);
+ last_used_time = info.GetLastModifiedTime();
- int64 file_size = FileEnumerator::GetFilesize(find_info);
+ int64 file_size = info.GetSize();
SimpleIndex::EntrySet::iterator it = index_file_entries->find(hash_key);
if (it == index_file_entries->end()) {
SimpleIndex::InsertInEntrySet(
« no previous file with comments | « net/disk_cache/simple/simple_index.cc ('k') | net/tools/dump_cache/dump_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698