diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 18:30:22 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 18:30:22 +0000 |
commit | 408d35f5f5c316b2f8df12be606a8ff8921ba5ca (patch) | |
tree | 44323772354a63ac53bb48997523abf37707ef1e /net/disk_cache/block_files.cc | |
parent | 9fa3c108d312d6664c51f02f203bc60fd4750156 (diff) | |
download | chromium_src-408d35f5f5c316b2f8df12be606a8ff8921ba5ca.zip chromium_src-408d35f5f5c316b2f8df12be606a8ff8921ba5ca.tar.gz chromium_src-408d35f5f5c316b2f8df12be606a8ff8921ba5ca.tar.bz2 |
Move remaining OS dependent bits from the main logic on the disk cache.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/block_files.cc')
-rw-r--r-- | net/disk_cache/block_files.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index 93578cf..79be295 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -217,11 +217,11 @@ std::wstring BlockFiles::Name(int index) { bool BlockFiles::CreateBlockFile(int index, FileType file_type, bool force) { std::wstring name = Name(index); - DWORD disposition = force ? CREATE_ALWAYS : CREATE_NEW; + int flags = force ? OS_FILE_CREATE_ALWAYS : OS_FILE_CREATE; + flags |= OS_FILE_WRITE | OS_FILE_SHARE_READ; - ScopedHandle file(CreateFile(name.c_str(), GENERIC_WRITE, FILE_SHARE_READ, - NULL, disposition, 0, NULL)); - if (!file.IsValid()) + scoped_refptr<File> file(new File(CreateOSFile(name.c_str(), flags, NULL))); + if (!file->IsValid()) return false; BlockFileHeader header; @@ -229,12 +229,7 @@ bool BlockFiles::CreateBlockFile(int index, FileType file_type, bool force) { header.this_file = static_cast<int16>(index); DCHECK(index <= kint16max && index >= 0); - DWORD actual; - if (!WriteFile(file.Get(), &header, sizeof(header), &actual, NULL) || - sizeof(header) != actual) - return false; - - return true; + return file->Write(&header, sizeof(header), 0); } bool BlockFiles::OpenBlockFile(int index) { |