OLD | NEW |
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 |
OLD | NEW |