diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 19:30:27 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 19:30:27 +0000 |
commit | ed65fece343181e91b4d36e161434cc763475de7 (patch) | |
tree | 27af7d7cb8a12f65b24dba3ebd5ede3d592e2d8e /net | |
parent | 2d723bc66e60bedd617ebd464996ee2388c0c365 (diff) | |
download | chromium_src-ed65fece343181e91b4d36e161434cc763475de7.zip chromium_src-ed65fece343181e91b4d36e161434cc763475de7.tar.gz chromium_src-ed65fece343181e91b4d36e161434cc763475de7.tar.bz2 |
Add an optional parameter to CreatePlatformFile() to report the type
of error that occured while trying to open/create a file.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3223007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/file_stream_posix.cc | 2 | ||||
-rw-r--r-- | net/base/file_stream_unittest.cc | 5 | ||||
-rw-r--r-- | net/base/file_stream_win.cc | 2 | ||||
-rw-r--r-- | net/disk_cache/backend_impl.cc | 4 | ||||
-rw-r--r-- | net/disk_cache/block_files.cc | 2 | ||||
-rw-r--r-- | net/disk_cache/disk_cache_test_util.cc | 2 | ||||
-rw-r--r-- | net/disk_cache/file_posix.cc | 2 |
7 files changed, 9 insertions, 10 deletions
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc index ba91db2..d338c14 100644 --- a/net/base/file_stream_posix.cc +++ b/net/base/file_stream_posix.cc @@ -345,7 +345,7 @@ int FileStream::Open(const FilePath& path, int open_flags) { } open_flags_ = open_flags; - file_ = base::CreatePlatformFile(path, open_flags_, NULL); + file_ = base::CreatePlatformFile(path, open_flags_, NULL, NULL); if (file_ == base::kInvalidPlatformFileValue) { LOG(WARNING) << "Failed to open file: " << errno << " (" << path.ToWStringHack() << ")"; diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index cf80699..b93d886 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -51,7 +51,7 @@ TEST_F(FileStreamTest, UseFileHandle) { file_util::WriteFile(temp_file_path(), kTestData, kTestDataSize)); int flags = base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_READ; base::PlatformFile file = base::CreatePlatformFile( - temp_file_path().ToWStringHack(), flags, &created); + temp_file_path(), flags, &created, NULL); // Seek to the beginning of the file and read. net::FileStream read_stream(file, flags); @@ -66,8 +66,7 @@ TEST_F(FileStreamTest, UseFileHandle) { // 2. Test writing with a file handle. file_util::Delete(temp_file_path(), false); flags = base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE; - file = base::CreatePlatformFile(temp_file_path().ToWStringHack(), - flags, &created); + file = base::CreatePlatformFile(temp_file_path(), flags, &created, NULL); net::FileStream write_stream(file, flags); ASSERT_EQ(0, write_stream.Seek(net::FROM_BEGIN, 0)); diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc index 0460b3d..234ddf9 100644 --- a/net/base/file_stream_win.cc +++ b/net/base/file_stream_win.cc @@ -159,7 +159,7 @@ int FileStream::Open(const FilePath& path, int open_flags) { } open_flags_ = open_flags; - file_ = base::CreatePlatformFile(path.value(), open_flags_, NULL); + file_ = base::CreatePlatformFile(path, open_flags_, NULL, NULL); if (file_ == INVALID_HANDLE_VALUE) { DWORD error = GetLastError(); LOG(WARNING) << "Failed to open file: " << error; diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index f518834..6b415b8 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -847,7 +847,7 @@ bool BackendImpl::CreateExternalFile(Addr* address) { base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_EXCLUSIVE_WRITE; scoped_refptr<disk_cache::File> file(new disk_cache::File( - base::CreatePlatformFile(name, flags, NULL))); + base::CreatePlatformFile(name, flags, NULL, NULL))); if (!file->IsValid()) continue; @@ -1240,7 +1240,7 @@ bool BackendImpl::InitBackingStore(bool* file_created) { base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_EXCLUSIVE_WRITE; scoped_refptr<disk_cache::File> file(new disk_cache::File( - base::CreatePlatformFile(index_name, flags, file_created))); + base::CreatePlatformFile(index_name, flags, file_created, NULL))); if (!file->IsValid()) return false; diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index 9f6c489..5461b7e 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -224,7 +224,7 @@ bool BlockFiles::CreateBlockFile(int index, FileType file_type, bool force) { flags |= base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE; scoped_refptr<File> file(new File( - base::CreatePlatformFile(name, flags, NULL))); + base::CreatePlatformFile(name, flags, NULL, NULL))); if (!file->IsValid()) return false; diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index 46e33db..f84b8b2 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -65,7 +65,7 @@ bool CreateCacheTestFile(const FilePath& name) { base::PLATFORM_FILE_WRITE; scoped_refptr<disk_cache::File> file(new disk_cache::File( - base::CreatePlatformFile(name, flags, NULL))); + base::CreatePlatformFile(name, flags, NULL, NULL))); if (!file->IsValid()) return false; diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index 1d842ed..44d74e7 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -260,7 +260,7 @@ bool File::Init(const FilePath& name) { int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE; - platform_file_ = base::CreatePlatformFile(name, flags, NULL); + platform_file_ = base::CreatePlatformFile(name, flags, NULL, NULL); if (platform_file_ < 0) { platform_file_ = 0; return false; |