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

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

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 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
« no previous file with comments | « net/disk_cache/cache_util_posix.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.cc
diff --git a/net/disk_cache/simple/simple_index.cc b/net/disk_cache/simple/simple_index.cc
index 7effb1ba591e2e7fb1b9f87f6ec41c88f61684c1..eb56a63ab93f2e5d05f83a7ea81b6148a46537b0 100644
--- a/net/disk_cache/simple/simple_index.cc
+++ b/net/disk_cache/simple/simple_index.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
+#include "base/files/file_enumerator.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
@@ -447,7 +448,6 @@ void SimpleIndex::InitializeInternal(
// static
scoped_ptr<SimpleIndex::EntrySet> SimpleIndex::RestoreFromDisk(
const base::FilePath& index_filename) {
- using file_util::FileEnumerator;
LOG(INFO) << "Simple Cache Index is being restored from disk.";
file_util::Delete(index_filename, /* recursive = */ false);
@@ -459,10 +459,10 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndex::RestoreFromDisk(
const int kFileSuffixLenght = std::string("_0").size();
const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*_[0-2]");
- FileEnumerator enumerator(index_filename.DirName(),
- false /* recursive */,
- FileEnumerator::FILES,
- file_pattern);
+ base::FileEnumerator enumerator(index_filename.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();
@@ -480,18 +480,17 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndex::RestoreFromDisk(
continue;
}
- FileEnumerator::FindInfo find_info = {};
- enumerator.GetFindInfo(&find_info);
+ base::FileEnumerator::FileInfo find_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(find_info.stat().st_atime);
#endif
if (last_used_time.is_null())
- last_used_time = FileEnumerator::GetLastModifiedTime(find_info);
+ last_used_time = find_info.GetLastModifiedTime();
- int64 file_size = FileEnumerator::GetFilesize(find_info);
+ int64 file_size = find_info.GetSize();
EntrySet::iterator it = index_file_entries->find(hash_key);
if (it == index_file_entries->end()) {
InsertInEntrySet(EntryMetadata(hash_key, last_used_time, file_size),
« no previous file with comments | « net/disk_cache/cache_util_posix.cc ('k') | net/tools/dump_cache/dump_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698