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

Side by Side Diff: net/disk_cache/cache_util_posix.cc

Issue 13315: Move file enumeration to filepaths. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
« no previous file with comments | « net/base/directory_lister.cc ('k') | net/tools/dump_cache/dump_files.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "net/disk_cache/cache_util.h" 5 #include "net/disk_cache/cache_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 10
11 namespace disk_cache { 11 namespace disk_cache {
12 12
13 bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) { 13 bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) {
14 // Just use the version from base. 14 // Just use the version from base.
15 return file_util::Move(from_path.c_str(), to_path.c_str()); 15 return file_util::Move(from_path.c_str(), to_path.c_str());
16 } 16 }
17 17
18 void DeleteCache(const std::wstring& path, bool remove_folder) { 18 void DeleteCache(const std::wstring& path, bool remove_folder) {
19 file_util::FileEnumerator iter(path, /* recursive */ false, 19 file_util::FileEnumerator iter(FilePath::FromWStringHack(path),
20 /* recursive */ false,
20 file_util::FileEnumerator::FILES); 21 file_util::FileEnumerator::FILES);
21 for (std::wstring file = iter.Next(); !file.empty(); file = iter.Next()) { 22 for (FilePath file = iter.Next(); !file.value().empty(); file = iter.Next()) {
22 if (!file_util::Delete(file, /* recursive */ false)) 23 if (!file_util::Delete(file, /* recursive */ false))
23 NOTREACHED(); 24 NOTREACHED();
24 } 25 }
25 26
26 if (remove_folder) { 27 if (remove_folder) {
27 if (!file_util::Delete(path, /* recursive */ false)) 28 if (!file_util::Delete(path, /* recursive */ false))
28 NOTREACHED(); 29 NOTREACHED();
29 } 30 }
30 } 31 }
31 32
32 bool DeleteCacheFile(const std::wstring& name) { 33 bool DeleteCacheFile(const std::wstring& name) {
33 return file_util::Delete(name, false); 34 return file_util::Delete(name, false);
34 } 35 }
35 36
36 void WaitForPendingIO(int* num_pending_io) { 37 void WaitForPendingIO(int* num_pending_io) {
37 if (*num_pending_io) { 38 if (*num_pending_io) {
38 NOTIMPLEMENTED(); 39 NOTIMPLEMENTED();
39 } 40 }
40 } 41 }
41 42
42 } // namespace disk_cache 43 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/base/directory_lister.cc ('k') | net/tools/dump_cache/dump_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698