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

Unified Diff: net/disk_cache/cache_util_win.cc

Issue 261045: Start migrating the disk cache to using FilePath. (Closed)
Patch Set: rebase Created 11 years, 2 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/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/cache_util_win.cc
diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc
index 3a99836ed7250fa932b2a17b566fb3fb68c0263c..46bffe8f99b7cc60d0a04231604f14675ef1d669 100644
--- a/net/disk_cache/cache_util_win.cc
+++ b/net/disk_cache/cache_util_win.cc
@@ -39,26 +39,34 @@ void DeleteFiles(const wchar_t* path, const wchar_t* search_name) {
namespace disk_cache {
-bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) {
+bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
// I don't want to use the shell version of move because if something goes
// wrong, that version will attempt to move file by file and fail at the end.
- if (!MoveFileEx(from_path.c_str(), to_path.c_str(), 0)) {
+ if (!MoveFileEx(from_path.value().c_str(), to_path.value().c_str(), 0)) {
LOG(ERROR) << "Unable to move the cache: " << GetLastError();
return false;
}
return true;
}
-void DeleteCache(const std::wstring& path, bool remove_folder) {
- DeleteFiles(path.c_str(), L"*");
+void DeleteCache(const FilePath& path, bool remove_folder) {
+ DeleteFiles(path.value().c_str(), L"*");
if (remove_folder)
- RemoveDirectory(path.c_str());
+ RemoveDirectory(path.value().c_str());
}
-bool DeleteCacheFile(const std::wstring& name) {
+bool DeleteCacheFile(const FilePath& name) {
// We do a simple delete, without ever falling back to SHFileOperation, as the
// version from base does.
- return DeleteFile(name.c_str()) ? true : false;
+ return DeleteFile(name.value().c_str()) ? true : false;
+}
+
+void DeleteCache(const std::wstring& path, bool remove_folder) {
+ DeleteCache(FilePath::FromWStringHack(path), remove_folder);
+}
+
+bool DeleteCacheFile(const std::wstring& name) {
+ return DeleteCacheFile(FilePath::FromWStringHack(name));
}
} // namespace disk_cache
« no previous file with comments | « net/disk_cache/cache_util_posix.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698