summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 21:39:37 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 21:39:37 +0000
commitf294da7127cd4c278aa1f172e94d382250e92e4e (patch)
tree2a7e899a35be6d2a899ae7916a3a250c362a53a9 /net/disk_cache
parent59fea0a2182828f3410a16ae68296cc9dcbbf8c2 (diff)
downloadchromium_src-f294da7127cd4c278aa1f172e94d382250e92e4e.zip
chromium_src-f294da7127cd4c278aa1f172e94d382250e92e4e.tar.gz
chromium_src-f294da7127cd4c278aa1f172e94d382250e92e4e.tar.bz2
Step 2 in porting disk cache to using FilePath.
BUG=24444 Review URL: http://codereview.chromium.org/270066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/block_files_unittest.cc2
-rw-r--r--net/disk_cache/entry_impl.cc2
-rw-r--r--net/disk_cache/file.h4
-rw-r--r--net/disk_cache/file_posix.cc2
-rw-r--r--net/disk_cache/file_win.cc9
-rw-r--r--net/disk_cache/mapped_file_posix.cc3
-rw-r--r--net/disk_cache/mapped_file_win.cc3
7 files changed, 16 insertions, 9 deletions
diff --git a/net/disk_cache/block_files_unittest.cc b/net/disk_cache/block_files_unittest.cc
index 6256a3d..2ea930e 100644
--- a/net/disk_cache/block_files_unittest.cc
+++ b/net/disk_cache/block_files_unittest.cc
@@ -170,7 +170,7 @@ TEST_F(DiskCacheTest, BlockFiles_ZeroSizeFile) {
// Truncate one of the files.
{
scoped_refptr<File> file(new File);
- ASSERT_TRUE(file->Init(filename));
+ ASSERT_TRUE(file->Init(FilePath::FromWStringHack(filename)));
EXPECT_TRUE(file->SetLength(0));
}
diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc
index 163f217..8749f26 100644
--- a/net/disk_cache/entry_impl.cc
+++ b/net/disk_cache/entry_impl.cc
@@ -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).ToWStringHack()))
+ if (file->Init(backend_->GetFileName(address)))
files_[index].swap(file);
}
return files_[index].get();
diff --git a/net/disk_cache/file.h b/net/disk_cache/file.h
index 3c167db..76c2f79 100644
--- a/net/disk_cache/file.h
+++ b/net/disk_cache/file.h
@@ -12,6 +12,8 @@
#include "base/platform_file.h"
#include "base/ref_counted.h"
+class FilePath;
+
namespace disk_cache {
// This interface is used to support asynchronous ReadData and WriteData calls.
@@ -39,7 +41,7 @@ class 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 std::wstring& name);
+ bool Init(const 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 b080f53..d3e903b 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -245,7 +245,7 @@ File::File(base::PlatformFile file)
: init_(true), mixed_(true), platform_file_(file) {
}
-bool File::Init(const std::wstring& name) {
+bool File::Init(const FilePath& name) {
if (init_)
return false;
diff --git a/net/disk_cache/file_win.cc b/net/disk_cache/file_win.cc
index b341caf..2b1f20b 100644
--- a/net/disk_cache/file_win.cc
+++ b/net/disk_cache/file_win.cc
@@ -4,6 +4,7 @@
#include "net/disk_cache/file.h"
+#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/singleton.h"
#include "net/disk_cache/disk_cache.h"
@@ -77,12 +78,13 @@ File::File(base::PlatformFile file)
sync_platform_file_(file) {
}
-bool File::Init(const std::wstring& name) {
+bool File::Init(const FilePath& name) {
DCHECK(!init_);
if (init_)
return false;
- platform_file_ = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE,
+ platform_file_ = CreateFile(name.value().c_str(),
+ GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
@@ -93,7 +95,8 @@ bool File::Init(const std::wstring& name) {
platform_file_, Singleton<CompletionHandler>::get());
init_ = true;
- sync_platform_file_ = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE,
+ sync_platform_file_ = CreateFile(name.value().c_str(),
+ GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
diff --git a/net/disk_cache/mapped_file_posix.cc b/net/disk_cache/mapped_file_posix.cc
index a28a7d4..6370ca6 100644
--- a/net/disk_cache/mapped_file_posix.cc
+++ b/net/disk_cache/mapped_file_posix.cc
@@ -7,6 +7,7 @@
#include <errno.h>
#include <sys/mman.h>
+#include "base/file_path.h"
#include "base/logging.h"
#include "net/disk_cache/disk_cache.h"
@@ -14,7 +15,7 @@ namespace disk_cache {
void* MappedFile::Init(const std::wstring& name, size_t size) {
DCHECK(!init_);
- if (init_ || !File::Init(name))
+ if (init_ || !File::Init(FilePath::FromWStringHack(name)))
return NULL;
if (!size)
diff --git a/net/disk_cache/mapped_file_win.cc b/net/disk_cache/mapped_file_win.cc
index 4299df4..0692961 100644
--- a/net/disk_cache/mapped_file_win.cc
+++ b/net/disk_cache/mapped_file_win.cc
@@ -4,6 +4,7 @@
#include "net/disk_cache/mapped_file.h"
+#include "base/file_path.h"
#include "base/logging.h"
#include "net/disk_cache/disk_cache.h"
@@ -11,7 +12,7 @@ namespace disk_cache {
void* MappedFile::Init(const std::wstring& name, size_t size) {
DCHECK(!init_);
- if (init_ || !File::Init(name))
+ if (init_ || !File::Init(FilePath::FromWStringHack(name)))
return NULL;
buffer_ = NULL;