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

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

Issue 22927018: Avoid fragmenting the heap too much while reconstructing the index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Egor's and Gavin's comments Created 7 years, 4 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
Index: net/disk_cache/simple/simple_index_file_win.cc
diff --git a/net/disk_cache/simple/simple_index_file_win.cc b/net/disk_cache/simple/simple_index_file_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ae106eeee3df1a9ef5286d593cbab39e6ae830dc
--- /dev/null
+++ b/net/disk_cache/simple/simple_index_file_win.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/disk_cache/simple/simple_index_file.h"
+
+#include <string>
+
+#include "base/files/file_enumerator.h"
+#include "base/files/file_path.h"
+
+namespace disk_cache {
+
+// static
+bool SimpleIndexFile::TraverseCacheDirectory(
+ const base::FilePath& cache_path,
+ const EntryFileCallback& entry_file_callback) {
+ const int kFileSuffixLength = sizeof("_0") - 1;
pasko 2013/08/21 16:03:17 this constant is unused also, the operation of th
Philippe 2013/08/21 16:20:58 Oops :) Yeah good point.
+ const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*_[0-2]");
+ base::FileEnumerator enumerator(
+ cache_path, false /* recursive */, base::FileEnumerator::FILES,
+ file_pattern);
+ for (base::FilePath file_path = enumerator.Next(); !file_path.empty();
+ file_path = enumerator.Next()) {
+ entry_file_callback.Run(file_path);
+ }
+ return true;
+}
+
+} // namespace disk_cache

Powered by Google App Engine
This is Rietveld 408576698