summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-08 20:40:15 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-08 20:40:15 +0000
commit6cdfd7f74ebadbe6fd2f557039b8b94242dd714e (patch)
tree39125d76f2a25515427dd53a81265d73bbb8ed18 /net/disk_cache
parent81aee95aa6bcb433e4bc26212ea3341edf839bdb (diff)
downloadchromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.zip
chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.tar.gz
chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.tar.bz2
Replace FilePath with base::FilePath in net.
Review URL: https://codereview.chromium.org/12218081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_impl.cc47
-rw-r--r--net/disk_cache/backend_impl.h10
-rw-r--r--net/disk_cache/backend_unittest.cc13
-rw-r--r--net/disk_cache/block_files.cc10
-rw-r--r--net/disk_cache/block_files.h6
-rw-r--r--net/disk_cache/block_files_unittest.cc11
-rw-r--r--net/disk_cache/cache_util_posix.cc14
-rw-r--r--net/disk_cache/cache_util_unittest.cc29
-rw-r--r--net/disk_cache/cache_util_win.cc10
-rw-r--r--net/disk_cache/disk_cache_test_base.cc2
-rw-r--r--net/disk_cache/disk_cache_test_base.h2
-rw-r--r--net/disk_cache/disk_cache_test_util.cc7
-rw-r--r--net/disk_cache/disk_cache_test_util.h7
-rw-r--r--net/disk_cache/entry_unittest.cc2
-rw-r--r--net/disk_cache/file.h2
-rw-r--r--net/disk_cache/file_posix.cc2
-rw-r--r--net/disk_cache/file_win.cc2
-rw-r--r--net/disk_cache/flash/flash_cache_test_base.cc4
-rw-r--r--net/disk_cache/flash/storage.cc4
-rw-r--r--net/disk_cache/flash/storage.h4
-rw-r--r--net/disk_cache/mapped_file_avoid_mmap_posix.cc2
-rw-r--r--net/disk_cache/mapped_file_posix.cc2
-rw-r--r--net/disk_cache/mapped_file_unittest.cc4
-rw-r--r--net/disk_cache/mapped_file_win.cc2
-rw-r--r--net/disk_cache/storage_block_unittest.cc6
-rw-r--r--net/disk_cache/stress_cache.cc4
26 files changed, 110 insertions, 98 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index e7fad5b..232b3f8 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -80,43 +80,45 @@ 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".
-FilePath GetPrefixedName(const FilePath& path, const std::string& name,
- int index) {
+base::FilePath GetPrefixedName(const base::FilePath& path,
+ const std::string& name,
+ int index) {
std::string tmp = base::StringPrintf("%s%s_%03d", "old_",
name.c_str(), index);
return path.AppendASCII(tmp);
}
// This is a simple callback to cleanup old caches.
-void CleanupCallback(const FilePath& path, const std::string& name) {
+void CleanupCallback(const base::FilePath& path, const std::string& name) {
for (int i = 0; i < kMaxOldFolders; i++) {
- FilePath to_delete = GetPrefixedName(path, name, i);
+ base::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.
-FilePath GetTempCacheName(const FilePath& path, const std::string& name) {
+base::FilePath GetTempCacheName(const base::FilePath& path,
+ const std::string& name) {
// We'll attempt to have up to kMaxOldFolders folders for deletion.
for (int i = 0; i < kMaxOldFolders; i++) {
- FilePath to_delete = GetPrefixedName(path, name, i);
+ base::FilePath to_delete = GetPrefixedName(path, name, i);
if (!file_util::PathExists(to_delete))
return to_delete;
}
- return FilePath();
+ return base::FilePath();
}
// Moves the cache files to a new folder and creates a task to delete them.
-bool DelayedCacheCleanup(const FilePath& full_path) {
+bool DelayedCacheCleanup(const base::FilePath& full_path) {
// GetTempCacheName() and MoveCache() use synchronous file
// operations.
base::ThreadRestrictions::ScopedAllowIO allow_io;
- FilePath current_path = full_path.StripTrailingSeparators();
+ base::FilePath current_path = full_path.StripTrailingSeparators();
- FilePath path = current_path.DirName();
- FilePath name = current_path.BaseName();
+ base::FilePath path = current_path.DirName();
+ base::FilePath name = current_path.BaseName();
#if defined(OS_POSIX)
std::string name_str = name.value();
#elif defined(OS_WIN)
@@ -124,7 +126,7 @@ bool DelayedCacheCleanup(const FilePath& full_path) {
std::string name_str = WideToASCII(name.value());
#endif
- FilePath to_delete = GetTempCacheName(path, name_str);
+ base::FilePath to_delete = GetTempCacheName(path, name_str);
if (to_delete.empty()) {
LOG(ERROR) << "Unable to get another cache folder";
return false;
@@ -159,7 +161,7 @@ bool InitExperiment(disk_cache::IndexHeader* header) {
// This class takes care of building an instance of the backend.
class CacheCreator {
public:
- CacheCreator(const FilePath& path, bool force, int max_bytes,
+ CacheCreator(const base::FilePath& path, bool force, int max_bytes,
net::CacheType type, uint32 flags,
base::MessageLoopProxy* thread, net::NetLog* net_log,
disk_cache::Backend** backend,
@@ -187,7 +189,7 @@ class CacheCreator {
// Callback implementation.
void OnIOComplete(int result);
- const FilePath& path_;
+ const base::FilePath& path_;
bool force_;
bool retry_;
int max_bytes_;
@@ -255,7 +257,8 @@ void FinalCleanupCallback(disk_cache::BackendImpl* backend) {
namespace disk_cache {
-int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes,
+int CreateCacheBackend(net::CacheType type, const base::FilePath& path,
+ int max_bytes,
bool force, base::MessageLoopProxy* thread,
net::NetLog* net_log, Backend** backend,
const net::CompletionCallback& callback) {
@@ -301,7 +304,7 @@ int PreferedCacheSize(int64 available) {
// ------------------------------------------------------------------------
-BackendImpl::BackendImpl(const FilePath& path,
+BackendImpl::BackendImpl(const base::FilePath& path,
base::MessageLoopProxy* cache_thread,
net::NetLog* net_log)
: ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)),
@@ -326,7 +329,7 @@ BackendImpl::BackendImpl(const FilePath& path,
ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {
}
-BackendImpl::BackendImpl(const FilePath& path,
+BackendImpl::BackendImpl(const base::FilePath& path,
uint32 mask,
base::MessageLoopProxy* cache_thread,
net::NetLog* net_log)
@@ -385,7 +388,7 @@ BackendImpl::~BackendImpl() {
// desired path) cannot be created.
//
// Static.
-int BackendImpl::CreateBackend(const FilePath& full_path, bool force,
+int BackendImpl::CreateBackend(const base::FilePath& full_path, bool force,
int max_bytes, net::CacheType type,
uint32 flags, base::MessageLoopProxy* thread,
net::NetLog* net_log, Backend** backend,
@@ -847,10 +850,10 @@ void BackendImpl::SetType(net::CacheType type) {
cache_type_ = type;
}
-FilePath BackendImpl::GetFileName(Addr address) const {
+base::FilePath BackendImpl::GetFileName(Addr address) const {
if (!address.is_separate_file() || !address.is_initialized()) {
NOTREACHED();
- return FilePath();
+ return base::FilePath();
}
std::string tmp = base::StringPrintf("f_%06x", address.FileNumber());
@@ -876,7 +879,7 @@ bool BackendImpl::CreateExternalFile(Addr* address) {
file_number = 1;
continue;
}
- FilePath name = GetFileName(file_address);
+ base::FilePath name = GetFileName(file_address);
int flags = base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE |
base::PLATFORM_FILE_CREATE |
@@ -1462,7 +1465,7 @@ bool BackendImpl::InitBackingStore(bool* file_created) {
if (!file_util::CreateDirectory(path_))
return false;
- FilePath index_name = path_.AppendASCII(kIndexName);
+ base::FilePath index_name = path_.AppendASCII(kIndexName);
int flags = base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE |
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index ad6f8ff..91faa83 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -42,16 +42,16 @@ enum BackendFlags {
class NET_EXPORT_PRIVATE BackendImpl : public Backend {
friend class Eviction;
public:
- BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread,
+ BackendImpl(const base::FilePath& path, base::MessageLoopProxy* cache_thread,
net::NetLog* net_log);
// mask can be used to limit the usable size of the hash table, for testing.
- BackendImpl(const FilePath& path, uint32 mask,
+ BackendImpl(const base::FilePath& path, uint32 mask,
base::MessageLoopProxy* cache_thread, net::NetLog* net_log);
virtual ~BackendImpl();
// Returns a new backend with the desired flags. See the declaration of
// CreateCacheBackend().
- static int CreateBackend(const FilePath& full_path, bool force,
+ static int CreateBackend(const base::FilePath& full_path, bool force,
int max_bytes, net::CacheType type,
uint32 flags, base::MessageLoopProxy* thread,
net::NetLog* net_log, Backend** backend,
@@ -94,7 +94,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
void SetType(net::CacheType type);
// Returns the full name for an external storage file.
- FilePath GetFileName(Addr address) const;
+ base::FilePath GetFileName(Addr address) const;
// Returns the actual file used to store a given (non-external) address.
MappedFile* File(Addr address);
@@ -357,7 +357,7 @@ class NET_EXPORT_PRIVATE BackendImpl : public Backend {
InFlightBackendIO background_queue_; // The controller of pending operations.
scoped_refptr<MappedFile> index_; // The main cache index.
- FilePath path_; // Path to the folder used as backing storage.
+ base::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 2ec657e..65cd3837 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -230,8 +230,9 @@ TEST_F(DiskCacheTest, CreateBackend) {
delete cache;
cache = NULL;
- rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE, FilePath(), 0, false,
- NULL, NULL, &cache, cb.callback());
+ rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE, base::FilePath(), 0,
+ false, NULL, NULL, &cache,
+ cb.callback());
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache);
delete cache;
@@ -243,7 +244,7 @@ TEST_F(DiskCacheTest, CreateBackend) {
// Testst that re-creating the cache performs the expected cleanup.
TEST_F(DiskCacheBackendTest, CreateBackend_MissingFile) {
ASSERT_TRUE(CopyTestCache("bad_entry"));
- FilePath filename = cache_path_.AppendASCII("data_1");
+ base::FilePath filename = cache_path_.AppendASCII("data_1");
file_util::Delete(filename, false);
DisableFirstCleanup();
SetForceCreation();
@@ -256,7 +257,7 @@ TEST_F(DiskCacheBackendTest, CreateBackend_MissingFile) {
TEST_F(DiskCacheBackendTest, ExternalFiles) {
InitCache();
// First, let's create a file on the folder.
- FilePath filename = cache_path_.AppendASCII("f_000001");
+ base::FilePath filename = cache_path_.AppendASCII("f_000001");
const int kSize = 50;
scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize));
@@ -441,7 +442,7 @@ TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate_Fast) {
TEST_F(DiskCacheTest, TruncatedIndex) {
ASSERT_TRUE(CleanupCacheDir());
- FilePath index = cache_path_.AppendASCII("index");
+ base::FilePath index = cache_path_.AppendASCII("index");
ASSERT_EQ(5, file_util::WriteFile(index, "hello", 5));
base::Thread cache_thread("CacheThread");
@@ -2520,7 +2521,7 @@ TEST_F(DiskCacheBackendTest, FileSharing) {
disk_cache::Addr address(0x80000001);
ASSERT_TRUE(cache_impl_->CreateExternalFile(&address));
- FilePath name = cache_impl_->GetFileName(address);
+ base::FilePath name = cache_impl_->GetFileName(address);
scoped_refptr<disk_cache::File> file(new disk_cache::File(false));
file->Init(name);
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc
index 0f7b729..8cab6da 100644
--- a/net/disk_cache/block_files.cc
+++ b/net/disk_cache/block_files.cc
@@ -218,7 +218,7 @@ bool ValidateCounters(const disk_cache::BlockFileHeader* header) {
namespace disk_cache {
-BlockFiles::BlockFiles(const FilePath& path)
+BlockFiles::BlockFiles(const base::FilePath& path)
: init_(false), zero_buffer_(NULL), path_(path) {
}
@@ -403,7 +403,7 @@ bool BlockFiles::IsValid(Addr address) {
}
bool BlockFiles::CreateBlockFile(int index, FileType file_type, bool force) {
- FilePath name = Name(index);
+ base::FilePath name = Name(index);
int flags =
force ? base::PLATFORM_FILE_CREATE_ALWAYS : base::PLATFORM_FILE_CREATE;
flags |= base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE;
@@ -428,7 +428,7 @@ bool BlockFiles::OpenBlockFile(int index) {
block_files_.resize(block_files_.size() + to_add);
}
- FilePath name = Name(index);
+ base::FilePath name = Name(index);
scoped_refptr<MappedFile> file(new MappedFile());
if (!file->Init(name, kBlockHeaderSize)) {
@@ -585,7 +585,7 @@ bool BlockFiles::RemoveEmptyFile(FileType block_type) {
// We get a new handle to the file and release the old one so that the
// file gets unmmaped... so we can delete it.
- FilePath name = Name(file_index);
+ base::FilePath name = Name(file_index);
scoped_refptr<File> this_file(new File(false));
this_file->Init(name);
block_files_[file_index]->Release();
@@ -677,7 +677,7 @@ void BlockFiles::GetFileStats(int index, int* used_count, int* load) {
*load = *used_count * 100 / max_blocks;
}
-FilePath BlockFiles::Name(int index) {
+base::FilePath BlockFiles::Name(int index) {
// The file format allows for 256 files.
DCHECK(index < 256 || index >= 0);
std::string tmp = base::StringPrintf("%s%d", kBlockName, index);
diff --git a/net/disk_cache/block_files.h b/net/disk_cache/block_files.h
index 88db317..cb0cf6d 100644
--- a/net/disk_cache/block_files.h
+++ b/net/disk_cache/block_files.h
@@ -25,7 +25,7 @@ namespace disk_cache {
// This class handles the set of block-files open by the disk cache.
class NET_EXPORT_PRIVATE BlockFiles {
public:
- explicit BlockFiles(const FilePath& path);
+ explicit BlockFiles(const base::FilePath& path);
~BlockFiles();
// Performs the object initialization. create_files indicates if the backing
@@ -83,11 +83,11 @@ class NET_EXPORT_PRIVATE BlockFiles {
void GetFileStats(int index, int* used_count, int* load);
// Returns the filename for a given file index.
- FilePath Name(int index);
+ base::FilePath Name(int index);
bool init_;
char* zero_buffer_; // Buffer to speed-up cleaning deleted entries.
- FilePath path_; // Path to the backing folder.
+ base::FilePath path_; // Path to the backing folder.
std::vector<MappedFile*> block_files_; // The actual files.
scoped_ptr<base::ThreadChecker> thread_checker_;
diff --git a/net/disk_cache/block_files_unittest.cc b/net/disk_cache/block_files_unittest.cc
index ebdae82..781c69b 100644
--- a/net/disk_cache/block_files_unittest.cc
+++ b/net/disk_cache/block_files_unittest.cc
@@ -14,10 +14,11 @@ using base::Time;
namespace {
// Returns the number of files in this folder.
-int NumberOfFiles(const FilePath& path) {
+int NumberOfFiles(const base::FilePath& path) {
file_util::FileEnumerator iter(path, false, file_util::FileEnumerator::FILES);
int count = 0;
- for (FilePath file = iter.Next(); !file.value().empty(); file = iter.Next()) {
+ for (base::FilePath file = iter.Next(); !file.value().empty();
+ file = iter.Next()) {
count++;
}
return count;
@@ -160,7 +161,7 @@ TEST_F(DiskCacheTest, BlockFiles_ZeroSizeFile) {
BlockFiles files(cache_path_);
ASSERT_TRUE(files.Init(true));
- FilePath filename = files.Name(0);
+ base::FilePath filename = files.Name(0);
files.CloseFiles();
// Truncate one of the files.
{
@@ -183,7 +184,7 @@ TEST_F(DiskCacheTest, BlockFiles_TruncatedFile) {
Addr address;
EXPECT_TRUE(files.CreateBlock(RANKINGS, 2, &address));
- FilePath filename = files.Name(0);
+ base::FilePath filename = files.Name(0);
files.CloseFiles();
// Truncate one of the files.
{
@@ -264,7 +265,7 @@ TEST_F(DiskCacheTest, BlockFiles_InvalidFile) {
EXPECT_TRUE(NULL == files.GetFile(addr));
// Let's create an invalid file.
- FilePath filename(files.Name(5));
+ base::FilePath filename(files.Name(5));
char header[kBlockHeaderSize];
memset(header, 'a', kBlockHeaderSize);
EXPECT_EQ(kBlockHeaderSize,
diff --git a/net/disk_cache/cache_util_posix.cc b/net/disk_cache/cache_util_posix.cc
index 9c2cf12..3cc9f3b 100644
--- a/net/disk_cache/cache_util_posix.cc
+++ b/net/disk_cache/cache_util_posix.cc
@@ -10,7 +10,7 @@
namespace disk_cache {
-bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
+bool MoveCache(const base::FilePath& from_path, const base::FilePath& to_path) {
#if defined(OS_CHROMEOS)
// For ChromeOS, we don't actually want to rename the cache
// directory, because if we do, then it'll get recreated through the
@@ -25,8 +25,9 @@ bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
file_util::FileEnumerator iter(from_path, false /* not recursive */,
file_util::FileEnumerator::DIRECTORIES |
file_util::FileEnumerator::FILES);
- for (FilePath name = iter.Next(); !name.value().empty(); name = iter.Next()) {
- FilePath destination = to_path.Append(name.BaseName());
+ for (base::FilePath name = iter.Next(); !name.value().empty();
+ name = iter.Next()) {
+ base::FilePath destination = to_path.Append(name.BaseName());
if (!file_util::Move(name, destination)) {
LOG(ERROR) << "Unable to move cache item.";
return false;
@@ -38,11 +39,12 @@ bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
#endif
}
-void DeleteCache(const FilePath& path, bool remove_folder) {
+void DeleteCache(const base::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()) {
+ for (base::FilePath file = iter.Next(); !file.value().empty();
+ file = iter.Next()) {
if (!file_util::Delete(file, /* recursive */ false)) {
LOG(WARNING) << "Unable to delete cache.";
return;
@@ -57,7 +59,7 @@ void DeleteCache(const FilePath& path, bool remove_folder) {
}
}
-bool DeleteCacheFile(const FilePath& name) {
+bool DeleteCacheFile(const base::FilePath& name) {
return file_util::Delete(name, false);
}
diff --git a/net/disk_cache/cache_util_unittest.cc b/net/disk_cache/cache_util_unittest.cc
index 07f0ac0..4485204 100644
--- a/net/disk_cache/cache_util_unittest.cc
+++ b/net/disk_cache/cache_util_unittest.cc
@@ -16,9 +16,9 @@ class CacheUtilTest : public PlatformTest {
PlatformTest::SetUp();
ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
cache_dir_ = tmp_dir_.path().Append(FILE_PATH_LITERAL("Cache"));
- file1_ = FilePath(cache_dir_.Append(FILE_PATH_LITERAL("file01")));
- file2_ = FilePath(cache_dir_.Append(FILE_PATH_LITERAL(".file02")));
- dir1_ = FilePath(cache_dir_.Append(FILE_PATH_LITERAL("dir01")));
+ file1_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL("file01")));
+ file2_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL(".file02")));
+ dir1_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL("dir01")));
ASSERT_TRUE(file_util::CreateDirectory(cache_dir_));
FILE *fp = file_util::OpenFile(file1_, "w");
ASSERT_TRUE(fp != NULL);
@@ -28,21 +28,22 @@ class CacheUtilTest : public PlatformTest {
file_util::CloseFile(fp);
ASSERT_TRUE(file_util::CreateDirectory(dir1_));
dest_dir_ = tmp_dir_.path().Append(FILE_PATH_LITERAL("old_Cache_001"));
- dest_file1_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL("file01")));
- dest_file2_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL(".file02")));
- dest_dir1_ = FilePath(dest_dir_.Append(FILE_PATH_LITERAL("dir01")));
+ dest_file1_ = base::FilePath(dest_dir_.Append(FILE_PATH_LITERAL("file01")));
+ dest_file2_ =
+ base::FilePath(dest_dir_.Append(FILE_PATH_LITERAL(".file02")));
+ dest_dir1_ = base::FilePath(dest_dir_.Append(FILE_PATH_LITERAL("dir01")));
}
protected:
base::ScopedTempDir tmp_dir_;
- FilePath cache_dir_;
- FilePath file1_;
- FilePath file2_;
- FilePath dir1_;
- FilePath dest_dir_;
- FilePath dest_file1_;
- FilePath dest_file2_;
- FilePath dest_dir1_;
+ base::FilePath cache_dir_;
+ base::FilePath file1_;
+ base::FilePath file2_;
+ base::FilePath dir1_;
+ base::FilePath dest_dir_;
+ base::FilePath dest_file1_;
+ base::FilePath dest_file2_;
+ base::FilePath dest_dir1_;
};
TEST_F(CacheUtilTest, MoveCache) {
diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc
index 6adc456..02f7365 100644
--- a/net/disk_cache/cache_util_win.cc
+++ b/net/disk_cache/cache_util_win.cc
@@ -14,8 +14,8 @@
namespace {
// Deletes all the files on path that match search_name pattern.
-void DeleteFiles(const FilePath& path, const wchar_t* search_name) {
- FilePath name(path.Append(search_name));
+void DeleteFiles(const base::FilePath& path, const wchar_t* search_name) {
+ base::FilePath name(path.Append(search_name));
WIN32_FIND_DATA data;
HANDLE handle = FindFirstFile(name.value().c_str(), &data);
@@ -36,7 +36,7 @@ void DeleteFiles(const FilePath& path, const wchar_t* search_name) {
namespace disk_cache {
-bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
+bool MoveCache(const base::FilePath& from_path, const base::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.value().c_str(), to_path.value().c_str(), 0)) {
@@ -46,13 +46,13 @@ bool MoveCache(const FilePath& from_path, const FilePath& to_path) {
return true;
}
-void DeleteCache(const FilePath& path, bool remove_folder) {
+void DeleteCache(const base::FilePath& path, bool remove_folder) {
DeleteFiles(path, L"*");
if (remove_folder)
RemoveDirectory(path.value().c_str());
}
-bool DeleteCacheFile(const FilePath& name) {
+bool DeleteCacheFile(const base::FilePath& name) {
// We do a simple delete, without ever falling back to SHFileOperation, as the
// version from base does.
if (!DeleteFile(name.value().c_str())) {
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index 76470a0..296713d 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -24,7 +24,7 @@ DiskCacheTest::~DiskCacheTest() {
}
bool DiskCacheTest::CopyTestCache(const std::string& name) {
- FilePath path;
+ base::FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path);
path = path.AppendASCII("net");
path = path.AppendASCII("data");
diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h
index c5442a4..8540af2 100644
--- a/net/disk_cache/disk_cache_test_base.h
+++ b/net/disk_cache/disk_cache_test_base.h
@@ -46,7 +46,7 @@ class DiskCacheTest : public PlatformTest {
virtual void TearDown() OVERRIDE;
- FilePath cache_path_;
+ base::FilePath cache_path_;
private:
base::ScopedTempDir temp_dir_;
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index dce005e..8307954 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -41,7 +41,7 @@ void CacheTestFillBuffer(char* buffer, size_t len, bool no_nulls) {
buffer[0] = 'g';
}
-bool CreateCacheTestFile(const FilePath& name) {
+bool CreateCacheTestFile(const base::FilePath& name) {
int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE;
@@ -55,12 +55,13 @@ bool CreateCacheTestFile(const FilePath& name) {
return true;
}
-bool DeleteCache(const FilePath& path) {
+bool DeleteCache(const base::FilePath& path) {
disk_cache::DeleteCache(path, false);
return true;
}
-bool CheckCacheIntegrity(const FilePath& path, bool new_eviction, uint32 mask) {
+bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction,
+ uint32 mask) {
scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
path, mask, base::MessageLoopProxy::current(), NULL));
if (!cache.get())
diff --git a/net/disk_cache/disk_cache_test_util.h b/net/disk_cache/disk_cache_test_util.h
index 80c8a7e..2e8f8b4 100644
--- a/net/disk_cache/disk_cache_test_util.h
+++ b/net/disk_cache/disk_cache_test_util.h
@@ -14,10 +14,10 @@
#include "build/build_config.h"
// Re-creates a given test file inside the cache test folder.
-bool CreateCacheTestFile(const FilePath& name);
+bool CreateCacheTestFile(const base::FilePath& name);
// Deletes all file son the cache.
-bool DeleteCache(const FilePath& path);
+bool DeleteCache(const base::FilePath& path);
// Fills buffer with random values (may contain nulls unless no_nulls is true).
void CacheTestFillBuffer(char* buffer, size_t len, bool no_nulls);
@@ -26,7 +26,8 @@ void CacheTestFillBuffer(char* buffer, size_t len, bool no_nulls);
std::string GenerateKey(bool same_length);
// Returns true if the cache is not corrupt.
-bool CheckCacheIntegrity(const FilePath& path, bool new_eviction, uint32 mask);
+bool CheckCacheIntegrity(const base::FilePath& path, bool new_eviction,
+ uint32 mask);
// -----------------------------------------------------------------------
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index 6438f2e..6e68034 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -1379,7 +1379,7 @@ TEST_F(DiskCacheEntryTest, MissingData) {
FlushQueueForTest();
disk_cache::Addr address(0x80000001);
- FilePath name = cache_impl_->GetFileName(address);
+ base::FilePath name = cache_impl_->GetFileName(address);
EXPECT_TRUE(file_util::Delete(name, false));
// Attempt to read the data.
diff --git a/net/disk_cache/file.h b/net/disk_cache/file.h
index 3f17ea0..3038d88 100644
--- a/net/disk_cache/file.h
+++ b/net/disk_cache/file.h
@@ -43,7 +43,7 @@ class NET_EXPORT_PRIVATE File : public base::RefCounted<File> {
// Initializes the object to point to a given file. The file must aready exist
// on disk, and allow shared read and write.
- bool Init(const FilePath& name);
+ bool Init(const base::FilePath& name);
// Returns the handle or file descriptor.
base::PlatformFile platform_file() const;
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index c334f28..0295c0d 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -175,7 +175,7 @@ File::File(base::PlatformFile file)
sync_platform_file_(base::kInvalidPlatformFileValue) {
}
-bool File::Init(const FilePath& name) {
+bool File::Init(const base::FilePath& name) {
if (init_)
return false;
diff --git a/net/disk_cache/file_win.cc b/net/disk_cache/file_win.cc
index 071b4ef..6679a0f 100644
--- a/net/disk_cache/file_win.cc
+++ b/net/disk_cache/file_win.cc
@@ -71,7 +71,7 @@ File::File(base::PlatformFile file)
sync_platform_file_(file) {
}
-bool File::Init(const FilePath& name) {
+bool File::Init(const base::FilePath& name) {
DCHECK(!init_);
if (init_)
return false;
diff --git a/net/disk_cache/flash/flash_cache_test_base.cc b/net/disk_cache/flash/flash_cache_test_base.cc
index 368eb91..a5c7678 100644
--- a/net/disk_cache/flash/flash_cache_test_base.cc
+++ b/net/disk_cache/flash/flash_cache_test_base.cc
@@ -14,7 +14,7 @@
namespace {
const int32 kSegmentCount = 10;
-const FilePath::StringType kCachePath = FILE_PATH_LITERAL("cache");
+const base::FilePath::StringType kCachePath = FILE_PATH_LITERAL("cache");
} // namespace
@@ -28,7 +28,7 @@ FlashCacheTest::~FlashCacheTest() {
void FlashCacheTest::SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- const FilePath path(temp_dir_.path().Append(kCachePath));
+ const base::FilePath path(temp_dir_.path().Append(kCachePath));
int32 storage_size = num_segments_in_storage_ * disk_cache::kFlashSegmentSize;
storage_.reset(new disk_cache::Storage(path, storage_size));
diff --git a/net/disk_cache/flash/storage.cc b/net/disk_cache/flash/storage.cc
index b6af0fe..c7136ef 100644
--- a/net/disk_cache/flash/storage.cc
+++ b/net/disk_cache/flash/storage.cc
@@ -13,7 +13,9 @@
namespace disk_cache {
-Storage::Storage(const FilePath& path, int32 size) : path_(path), size_(size) {
+Storage::Storage(const base::FilePath& path,
+ int32 size)
+ : path_(path), size_(size) {
COMPILE_ASSERT(kFlashPageSize % 2 == 0, invalid_page_size);
COMPILE_ASSERT(kFlashBlockSize % kFlashPageSize == 0, invalid_block_size);
DCHECK(size_ % kFlashBlockSize == 0);
diff --git a/net/disk_cache/flash/storage.h b/net/disk_cache/flash/storage.h
index 756014f..38c4a4e 100644
--- a/net/disk_cache/flash/storage.h
+++ b/net/disk_cache/flash/storage.h
@@ -13,7 +13,7 @@ namespace disk_cache {
class NET_EXPORT_PRIVATE Storage {
public:
- Storage(const FilePath& path, int32 size);
+ Storage(const base::FilePath& path, int32 size);
bool Init();
~Storage();
@@ -23,7 +23,7 @@ class NET_EXPORT_PRIVATE Storage {
bool Write(const void* buffer, int32 size, int32 offset);
private:
- FilePath path_;
+ base::FilePath path_;
int32 size_;
base::PlatformFile file_;
diff --git a/net/disk_cache/mapped_file_avoid_mmap_posix.cc b/net/disk_cache/mapped_file_avoid_mmap_posix.cc
index 0fd6d2b..061d106 100644
--- a/net/disk_cache/mapped_file_avoid_mmap_posix.cc
+++ b/net/disk_cache/mapped_file_avoid_mmap_posix.cc
@@ -11,7 +11,7 @@
namespace disk_cache {
-void* MappedFile::Init(const FilePath& name, size_t size) {
+void* MappedFile::Init(const base::FilePath& name, size_t size) {
DCHECK(!init_);
if (init_ || !File::Init(name))
return NULL;
diff --git a/net/disk_cache/mapped_file_posix.cc b/net/disk_cache/mapped_file_posix.cc
index 2dfa7ae..cc5f23e 100644
--- a/net/disk_cache/mapped_file_posix.cc
+++ b/net/disk_cache/mapped_file_posix.cc
@@ -13,7 +13,7 @@
namespace disk_cache {
-void* MappedFile::Init(const FilePath& name, size_t size) {
+void* MappedFile::Init(const base::FilePath& name, size_t size) {
DCHECK(!init_);
if (init_ || !File::Init(name))
return NULL;
diff --git a/net/disk_cache/mapped_file_unittest.cc b/net/disk_cache/mapped_file_unittest.cc
index 297de33..06f8760 100644
--- a/net/disk_cache/mapped_file_unittest.cc
+++ b/net/disk_cache/mapped_file_unittest.cc
@@ -42,7 +42,7 @@ void FileCallbackTest::OnFileIOComplete(int bytes_copied) {
} // namespace
TEST_F(DiskCacheTest, MappedFile_SyncIO) {
- FilePath filename = cache_path_.AppendASCII("a_test");
+ base::FilePath filename = cache_path_.AppendASCII("a_test");
scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile);
ASSERT_TRUE(CreateCacheTestFile(filename));
ASSERT_TRUE(file->Init(filename, 8192));
@@ -57,7 +57,7 @@ TEST_F(DiskCacheTest, MappedFile_SyncIO) {
}
TEST_F(DiskCacheTest, MappedFile_AsyncIO) {
- FilePath filename = cache_path_.AppendASCII("a_test");
+ base::FilePath filename = cache_path_.AppendASCII("a_test");
scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile);
ASSERT_TRUE(CreateCacheTestFile(filename));
ASSERT_TRUE(file->Init(filename, 8192));
diff --git a/net/disk_cache/mapped_file_win.cc b/net/disk_cache/mapped_file_win.cc
index f7575ef..7db2ba5 100644
--- a/net/disk_cache/mapped_file_win.cc
+++ b/net/disk_cache/mapped_file_win.cc
@@ -11,7 +11,7 @@
namespace disk_cache {
-void* MappedFile::Init(const FilePath& name, size_t size) {
+void* MappedFile::Init(const base::FilePath& name, size_t size) {
DCHECK(!init_);
if (init_ || !File::Init(name))
return NULL;
diff --git a/net/disk_cache/storage_block_unittest.cc b/net/disk_cache/storage_block_unittest.cc
index 1a3ec29..99232d4 100644
--- a/net/disk_cache/storage_block_unittest.cc
+++ b/net/disk_cache/storage_block_unittest.cc
@@ -10,7 +10,7 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST_F(DiskCacheTest, StorageBlock_LoadStore) {
- FilePath filename = cache_path_.AppendASCII("a_test");
+ base::FilePath filename = cache_path_.AppendASCII("a_test");
scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile);
ASSERT_TRUE(CreateCacheTestFile(filename));
ASSERT_TRUE(file->Init(filename, 8192));
@@ -30,7 +30,7 @@ TEST_F(DiskCacheTest, StorageBlock_LoadStore) {
}
TEST_F(DiskCacheTest, StorageBlock_SetData) {
- FilePath filename = cache_path_.AppendASCII("a_test");
+ base::FilePath filename = cache_path_.AppendASCII("a_test");
scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile);
ASSERT_TRUE(CreateCacheTestFile(filename));
ASSERT_TRUE(file->Init(filename, 8192));
@@ -50,7 +50,7 @@ TEST_F(DiskCacheTest, StorageBlock_SetData) {
}
TEST_F(DiskCacheTest, StorageBlock_SetModified) {
- FilePath filename = cache_path_.AppendASCII("a_test");
+ base::FilePath filename = cache_path_.AppendASCII("a_test");
scoped_refptr<disk_cache::MappedFile> file(new disk_cache::MappedFile);
ASSERT_TRUE(CreateCacheTestFile(filename));
ASSERT_TRUE(file->Init(filename, 8192));
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index cb63557..04d6f97 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -51,7 +51,7 @@ const int kExpectedCrash = 100;
// Starts a new process.
int RunSlave(int iteration) {
- FilePath exe;
+ base::FilePath exe;
PathService::Get(base::FILE_EXE, &exe);
CommandLine cmdline(exe);
@@ -102,7 +102,7 @@ void StressTheCache(int iteration) {
int cache_size = 0x2000000; // 32MB.
uint32 mask = 0xfff; // 4096 entries.
- FilePath path;
+ base::FilePath path;
PathService::Get(base::DIR_TEMP, &path);
path = path.AppendASCII("cache_test_stress");