diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 17:14:59 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-12 17:14:59 +0000 |
commit | cfaa1f2938c346d4801b895e7181f5de7d3755e6 (patch) | |
tree | 934967a90f94c5d50939929dd6ab38ad5dceed3e /net | |
parent | 1ee19742db740fb60ed78266039f65c93c85c836 (diff) | |
download | chromium_src-cfaa1f2938c346d4801b895e7181f5de7d3755e6.zip chromium_src-cfaa1f2938c346d4801b895e7181f5de7d3755e6.tar.gz chromium_src-cfaa1f2938c346d4801b895e7181f5de7d3755e6.tar.bz2 |
Start migrating the disk cache to using FilePath.
This converts BackendImpl to using FilePath.
BUG=24444
Review URL: http://codereview.chromium.org/261045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 85 | ||||
-rw-r--r-- | net/disk_cache/backend_impl.h | 13 | ||||
-rw-r--r-- | net/disk_cache/backend_unittest.cc | 2 | ||||
-rw-r--r-- | net/disk_cache/cache_util.h | 8 | ||||
-rw-r--r-- | net/disk_cache/cache_util_posix.cc | 18 | ||||
-rw-r--r-- | net/disk_cache/cache_util_win.cc | 22 | ||||
-rw-r--r-- | net/disk_cache/disk_cache_test_base.cc | 6 | ||||
-rw-r--r-- | net/disk_cache/disk_cache_test_base.h | 4 | ||||
-rw-r--r-- | net/disk_cache/disk_cache_test_util.cc | 3 | ||||
-rw-r--r-- | net/disk_cache/entry_impl.cc | 6 | ||||
-rw-r--r-- | net/disk_cache/stress_cache.cc | 3 | ||||
-rw-r--r-- | net/tools/crash_cache/crash_cache.cc | 3 | ||||
-rw-r--r-- | net/tools/dump_cache/upgrade.cc | 5 |
13 files changed, 104 insertions, 74 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 36ab4c2..3c48d8e 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -29,7 +29,7 @@ using base::TimeDelta; namespace { -const wchar_t* kIndexName = L"index"; +const char* kIndexName = "index"; const int kMaxOldFolders = 100; // Seems like ~240 MB correspond to less than 50k entries for 99% of the people. @@ -65,72 +65,74 @@ size_t GetIndexSize(int table_len) { // Returns a fully qualified name from path and name, using a given name prefix // and index number. For instance, if the arguments are "/foo", "bar" and 5, it // will return "/foo/old_bar_005". -std::wstring GetPrefixedName(const std::wstring& path, const std::wstring& name, - int index) { - std::wstring prefixed(path); - std::wstring tmp = StringPrintf(L"%ls%ls_%03d", L"old_", name.c_str(), index); - file_util::AppendToPath(&prefixed, tmp); - return prefixed; +FilePath GetPrefixedName(const FilePath& path, const std::string& name, + int index) { + std::string tmp = StringPrintf("%s%s_%03d", "old_", name.c_str(), index); + return path.AppendASCII(tmp); } // This is a simple Task to cleanup old caches. class CleanupTask : public Task { public: - CleanupTask(const std::wstring& path, const std::wstring& name) + CleanupTask(const FilePath& path, const std::string& name) : path_(path), name_(name) {} virtual void Run(); private: - std::wstring path_; - std::wstring name_; + FilePath path_; + std::string name_; DISALLOW_EVIL_CONSTRUCTORS(CleanupTask); }; void CleanupTask::Run() { for (int i = 0; i < kMaxOldFolders; i++) { - std::wstring to_delete = GetPrefixedName(path_, name_, i); + FilePath to_delete = GetPrefixedName(path_, name_, i); disk_cache::DeleteCache(to_delete, true); } } // Returns a full path to rename the current cache, in order to delete it. path // is the current folder location, and name is the current folder name. -std::wstring GetTempCacheName(const std::wstring& path, - const std::wstring& name) { +FilePath GetTempCacheName(const FilePath& path, const std::string& name) { // We'll attempt to have up to kMaxOldFolders folders for deletion. for (int i = 0; i < kMaxOldFolders; i++) { - std::wstring to_delete = GetPrefixedName(path, name, i); + FilePath to_delete = GetPrefixedName(path, name, i); if (!file_util::PathExists(to_delete)) return to_delete; } - return std::wstring(); + return FilePath(); } // Moves the cache files to a new folder and creates a task to delete them. -bool DelayedCacheCleanup(const std::wstring& full_path) { - FilePath current_path = FilePath::FromWStringHack(full_path); - current_path = current_path.StripTrailingSeparators(); - - std::wstring path = current_path.DirName().ToWStringHack(); - std::wstring name = current_path.BaseName().ToWStringHack(); +bool DelayedCacheCleanup(const FilePath& full_path) { + FilePath current_path = full_path.StripTrailingSeparators(); + + FilePath path = current_path.DirName(); + FilePath name = current_path.BaseName(); +#if defined(OS_POSIX) + std::string name_str = name.value(); +#elif defined(OS_WIN) + // We created this file so it should only contain ASCII. + std::string name_str = WideToASCII(name.value()); +#endif - std::wstring to_delete = GetTempCacheName(path, name); + FilePath to_delete = GetTempCacheName(path, name_str); if (to_delete.empty()) { LOG(ERROR) << "Unable to get another cache folder"; return false; } - if (!disk_cache::MoveCache(full_path.c_str(), to_delete.c_str())) { + if (!disk_cache::MoveCache(full_path, to_delete)) { LOG(ERROR) << "Unable to rename cache folder"; return false; } #if defined(OS_WIN) - WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name), true); + WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true); #elif defined(OS_POSIX) // TODO(rvargas): Use the worker pool. - MessageLoop::current()->PostTask(FROM_HERE, new CleanupTask(path, name)); + MessageLoop::current()->PostTask(FROM_HERE, new CleanupTask(path, name_str)); #endif return true; } @@ -215,7 +217,8 @@ int PreferedCacheSize(int64 available) { Backend* BackendImpl::CreateBackend(const std::wstring& full_path, bool force, int max_bytes, net::CacheType type, BackendFlags flags) { - BackendImpl* cache = new BackendImpl(full_path); + FilePath full_cache_path = FilePath::FromWStringHack(full_path); + BackendImpl* cache = new BackendImpl(full_cache_path); cache->SetMaxSize(max_bytes); cache->SetType(type); cache->SetFlags(flags); @@ -226,12 +229,12 @@ Backend* BackendImpl::CreateBackend(const std::wstring& full_path, bool force, if (!force) return NULL; - if (!DelayedCacheCleanup(full_path)) + if (!DelayedCacheCleanup(full_cache_path)) return NULL; // The worker thread will start deleting files soon, but the original folder // is not there anymore... let's create a new set of files. - cache = new BackendImpl(full_path); + cache = new BackendImpl(full_cache_path); cache->SetMaxSize(max_bytes); cache->SetType(type); cache->SetFlags(flags); @@ -478,7 +481,7 @@ bool BackendImpl::DoomEntry(const std::string& key) { bool BackendImpl::DoomAllEntries() { if (!num_refs_) { PrepareForRestart(); - DeleteCache(path_.c_str(), false); + DeleteCache(path_, false); return Init(); } else { if (disabled_) @@ -610,16 +613,14 @@ void BackendImpl::SetType(net::CacheType type) { cache_type_ = type; } -std::wstring BackendImpl::GetFileName(Addr address) const { +FilePath BackendImpl::GetFileName(Addr address) const { if (!address.is_separate_file() || !address.is_initialized()) { NOTREACHED(); - return std::wstring(); + return FilePath(); } - std::wstring name(path_); - std::wstring tmp = StringPrintf(L"f_%06x", address.FileNumber()); - file_util::AppendToPath(&name, tmp); - return name; + std::string tmp = StringPrintf("f_%06x", address.FileNumber()); + return path_.AppendASCII(tmp); } MappedFile* BackendImpl::File(Addr address) { @@ -637,13 +638,13 @@ bool BackendImpl::CreateExternalFile(Addr* address) { file_number = 1; continue; } - std::wstring name = GetFileName(file_address); + FilePath name = GetFileName(file_address); int flags = base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_EXCLUSIVE_WRITE; scoped_refptr<disk_cache::File> file(new disk_cache::File( - base::CreatePlatformFile(name.c_str(), flags, NULL))); + base::CreatePlatformFile(name.ToWStringHack().c_str(), flags, NULL))); if (!file->IsValid()) continue; @@ -988,15 +989,15 @@ bool BackendImpl::CreateBackingStore(disk_cache::File* file) { bool BackendImpl::InitBackingStore(bool* file_created) { file_util::CreateDirectory(path_); - std::wstring index_name(path_); - file_util::AppendToPath(&index_name, kIndexName); + FilePath index_name = path_.AppendASCII(kIndexName); int flags = base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_EXCLUSIVE_WRITE; scoped_refptr<disk_cache::File> file(new disk_cache::File( - base::CreatePlatformFile(index_name.c_str(), flags, file_created))); + base::CreatePlatformFile(index_name.ToWStringHack().c_str(), flags, + file_created))); if (!file->IsValid()) return false; @@ -1010,7 +1011,7 @@ bool BackendImpl::InitBackingStore(bool* file_created) { return false; index_ = new MappedFile(); - data_ = reinterpret_cast<Index*>(index_->Init(index_name, 0)); + data_ = reinterpret_cast<Index*>(index_->Init(index_name.ToWStringHack(), 0)); if (!data_) { LOG(ERROR) << "Unable to map Index file"; return false; @@ -1028,7 +1029,7 @@ void BackendImpl::AdjustMaxCacheSize(int table_len) { DCHECK(!table_len || data_->header.magic); // The user is not setting the size, let's figure it out. - int64 available = base::SysInfo::AmountOfFreeDiskSpace(path_); + int64 available = base::SysInfo::AmountOfFreeDiskSpace(path_.ToWStringHack()); if (available < 0) { max_size_ = kDefaultCacheSize; return; diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index 40bae4b..00711a9 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -7,6 +7,7 @@ #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ #define NET_DISK_CACHE_BACKEND_IMPL_H_ +#include "base/file_path.h" #include "base/hash_tables.h" #include "base/timer.h" #include "net/disk_cache/block_files.h" @@ -34,15 +35,15 @@ enum BackendFlags { class BackendImpl : public Backend { friend class Eviction; public: - explicit BackendImpl(const std::wstring& path) - : path_(path), block_files_(path), mask_(0), max_size_(0), + explicit BackendImpl(const FilePath& path) + : path_(path), block_files_(path.ToWStringHack()), mask_(0), max_size_(0), cache_type_(net::DISK_CACHE), uma_report_(0), user_flags_(0), init_(false), restarted_(false), unit_test_(false), read_only_(false), new_eviction_(false), first_timer_(true), ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {} // mask can be used to limit the usable size of the hash table, for testing. - BackendImpl(const std::wstring& path, uint32 mask) - : path_(path), block_files_(path), mask_(mask), max_size_(0), + BackendImpl(const FilePath& path, uint32 mask) + : path_(path), block_files_(path.ToWStringHack()), mask_(mask), max_size_(0), cache_type_(net::DISK_CACHE), uma_report_(0), user_flags_(kMask), init_(false), restarted_(false), unit_test_(false), read_only_(false), new_eviction_(false), first_timer_(true), @@ -78,7 +79,7 @@ class BackendImpl : public Backend { void SetType(net::CacheType type); // Returns the full name for an external storage file. - std::wstring GetFileName(Addr address) const; + FilePath GetFileName(Addr address) const; // Returns the actual file used to store a given (non-external) address. MappedFile* File(Addr address); @@ -262,7 +263,7 @@ class BackendImpl : public Backend { bool CheckEntry(EntryImpl* cache_entry); scoped_refptr<MappedFile> index_; // The main cache index. - std::wstring path_; // Path to the folder used as backing storage. + FilePath path_; // Path to the folder used as backing storage. Index* data_; // Pointer to the index data. BlockFiles block_files_; // Set of files used to store all data. Rankings rankings_; // Rankings to be able to trim the cache. diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index ffa873c..27b091b 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -1431,7 +1431,7 @@ TEST_F(DiskCacheTest, Backend_UsageStats) { std::wstring path = GetCachePath(); ASSERT_TRUE(DeleteCache(path.c_str())); scoped_ptr<disk_cache::BackendImpl> cache; - cache.reset(new disk_cache::BackendImpl(path)); + cache.reset(new disk_cache::BackendImpl(FilePath::FromWStringHack(path))); ASSERT_TRUE(NULL != cache.get()); cache->SetUnitTestMode(); ASSERT_TRUE(cache->Init()); diff --git a/net/disk_cache/cache_util.h b/net/disk_cache/cache_util.h index cb09521..7c91574 100644 --- a/net/disk_cache/cache_util.h +++ b/net/disk_cache/cache_util.h @@ -9,17 +9,23 @@ #include "base/basictypes.h" +class FilePath; + namespace disk_cache { // Moves the cache files from the given path to another location. // Returns true if successful, false otherwise. -bool MoveCache(const std::wstring& from_path, const std::wstring& to_path); +bool MoveCache(const FilePath& from_path, const FilePath& to_path); // Deletes the cache files stored on |path|, and optionally also attempts to // delete the folder itself. +void DeleteCache(const FilePath& path, bool remove_folder); +// Deprecated. void DeleteCache(const std::wstring& path, bool remove_folder); // Deletes a cache file. +bool DeleteCacheFile(const FilePath& name); +// Deprecated. bool DeleteCacheFile(const std::wstring& name); } // namespace disk_cache diff --git a/net/disk_cache/cache_util_posix.cc b/net/disk_cache/cache_util_posix.cc index cd8fdea..180e521 100644 --- a/net/disk_cache/cache_util_posix.cc +++ b/net/disk_cache/cache_util_posix.cc @@ -10,13 +10,13 @@ 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) { // Just use the version from base. - return file_util::Move(from_path.c_str(), to_path.c_str()); + return file_util::Move(from_path, to_path); } -void DeleteCache(const std::wstring& path, bool remove_folder) { - file_util::FileEnumerator iter(FilePath::FromWStringHack(path), +void DeleteCache(const FilePath& path, bool remove_folder) { + file_util::FileEnumerator iter(path, /* recursive */ false, file_util::FileEnumerator::FILES); for (FilePath file = iter.Next(); !file.value().empty(); file = iter.Next()) { @@ -30,8 +30,16 @@ void DeleteCache(const std::wstring& path, bool remove_folder) { } } -bool DeleteCacheFile(const std::wstring& name) { +bool DeleteCacheFile(const FilePath& name) { return file_util::Delete(name, 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 diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc index 3a99836..46bffe8 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 diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc index a148f4c..e2ced30 100644 --- a/net/disk_cache/disk_cache_test_base.cc +++ b/net/disk_cache/disk_cache_test_base.cc @@ -57,14 +57,14 @@ void DiskCacheTestWithCache::InitDiskCache() { ASSERT_TRUE(DeleteCache(path.c_str())); if (implementation_) - return InitDiskCacheImpl(path); + return InitDiskCacheImpl(FilePath::FromWStringHack(path)); cache_ = disk_cache::BackendImpl::CreateBackend(path, force_creation_, size_, net::DISK_CACHE, disk_cache::kNoRandom); } -void DiskCacheTestWithCache::InitDiskCacheImpl(const std::wstring& path) { +void DiskCacheTestWithCache::InitDiskCacheImpl(const FilePath& path) { if (mask_) cache_impl_ = new disk_cache::BackendImpl(path, mask_); else @@ -104,7 +104,7 @@ void DiskCacheTestWithCache::SimulateCrash() { std::wstring path = GetCachePath(); EXPECT_TRUE(CheckCacheIntegrity(path, new_eviction_)); - InitDiskCacheImpl(path); + InitDiskCacheImpl(FilePath::FromWStringHack(path)); } void DiskCacheTestWithCache::SetTestMode() { diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h index 13e866e..c198e22 100644 --- a/net/disk_cache/disk_cache_test_base.h +++ b/net/disk_cache/disk_cache_test_base.h @@ -9,6 +9,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +class FilePath; + namespace disk_cache { class Backend; @@ -90,7 +92,7 @@ class DiskCacheTestWithCache : public DiskCacheTest { private: void InitMemoryCache(); void InitDiskCache(); - void InitDiskCacheImpl(const std::wstring& path); + void InitDiskCacheImpl(const FilePath& path); }; #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index a1afb1e..77d731f 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -78,7 +78,8 @@ bool DeleteCache(const wchar_t* path) { } bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) { - scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(path)); + scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl( + FilePath::FromWStringHack(path))); if (!cache.get()) return false; if (new_eviction) diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 7d877c5..163f217 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -657,8 +657,8 @@ void EntryImpl::DeleteData(Addr address, int index) { int failure = DeleteCacheFile(backend_->GetFileName(address)) ? 0 : 1; CACHE_UMA(COUNTS, "DeleteFailed", 0, failure); if (failure) - LOG(ERROR) << "Failed to delete " << backend_->GetFileName(address) << - " from the cache."; + LOG(ERROR) << "Failed to delete " << + backend_->GetFileName(address).value() << " from the cache."; } else { backend_->DeleteBlock(address, true); } @@ -692,7 +692,7 @@ File* EntryImpl::GetExternalFile(Addr address, int index) { if (!files_[index].get()) { // For a key file, use mixed mode IO. scoped_refptr<File> file(new File(kKeyFileIndex == index)); - if (file->Init(backend_->GetFileName(address))) + if (file->Init(backend_->GetFileName(address).ToWStringHack())) files_[index].swap(file); } return files_[index].get(); diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index 7b5912c..e1f5760 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -78,7 +78,8 @@ void StressTheCache(int iteration) { int cache_size = 0x800000; // 8MB std::wstring path = GetCachePath(); path.append(L"_stress"); - disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(path); + disk_cache::BackendImpl* cache = + new disk_cache::BackendImpl(FilePath::FromWStringHack(path)); cache->SetFlags(disk_cache::kNoLoadProtection | disk_cache::kNoRandom); cache->SetMaxSize(cache_size); cache->SetType(net::DISK_CACHE); diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index 5272e17..36c64e2 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -214,7 +214,8 @@ int LoadOperations(const std::wstring& path, RankCrashes action) { DCHECK(action >= disk_cache::INSERT_LOAD_1); // Work with a tiny index table (16 entries) - disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(path, 0xf); + disk_cache::BackendImpl* cache = + new disk_cache::BackendImpl(FilePath::FromWStringHack(path), 0xf); if (!cache || !cache->SetMaxSize(0x100000) || !cache->Init() || cache->GetEntryCount()) return GENERIC; diff --git a/net/tools/dump_cache/upgrade.cc b/net/tools/dump_cache/upgrade.cc index de0f878..566eb0b 100644 --- a/net/tools/dump_cache/upgrade.cc +++ b/net/tools/dump_cache/upgrade.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/file_path.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" @@ -301,7 +302,7 @@ bool MasterSM::DoInit() { if (dump_to_disk_) { writer_ = new DiskDumper(path_); } else { - cache_.reset(new disk_cache::BackendImpl(path_)); + cache_.reset(new disk_cache::BackendImpl(FilePath::FromWStringHack(path_))); if (!cache_->Init()) { printf("Unable to initialize new files\n"); return false; @@ -509,7 +510,7 @@ class SlaveSM : public BaseSM { public: SlaveSM(const std::wstring& path, HANDLE channel) : BaseSM(channel), iterator_(NULL) { - cache_.reset(new disk_cache::BackendImpl(path)); + cache_.reset(new disk_cache::BackendImpl(FilePath::FromWStringHack(path))); if (!cache_->Init()) { printf("Unable to open cache files\n"); return; |