summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/file.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-13 18:30:22 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-13 18:30:22 +0000
commit408d35f5f5c316b2f8df12be606a8ff8921ba5ca (patch)
tree44323772354a63ac53bb48997523abf37707ef1e /net/disk_cache/file.h
parent9fa3c108d312d6664c51f02f203bc60fd4750156 (diff)
downloadchromium_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/file.h')
-rw-r--r--net/disk_cache/file.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/net/disk_cache/file.h b/net/disk_cache/file.h
index db42026..f692b01 100644
--- a/net/disk_cache/file.h
+++ b/net/disk_cache/file.h
@@ -33,6 +33,7 @@
#define NET_DISK_CACHE_FILE_H__
#include "base/ref_counted.h"
+#include "net/disk_cache/os_file.h"
namespace disk_cache {
@@ -52,19 +53,20 @@ class File : public base::RefCounted<File> {
// mixed_mode set to true enables regular synchronous operations for the file.
explicit File(bool mixed_mode) : init_(false), mixed_(mixed_mode) {}
+ // Initializes the object to use the passed in file instead of opening it with
+ // the Init() call. No asynchronous operations can be performed with this
+ // object.
+ explicit File(OSFile 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);
-#ifdef WIN32
- HANDLE handle() const {
- return handle_;
- }
-#else
- int file_descriptor() const {
- return file_descriptor_;
- }
-#endif
+ // Returns the handle or file descriptor.
+ OSFile os_file() const;
+
+ // Returns true if the file was opened properly.
+ bool IsValid() const;
// Performs synchronous IO.
bool Read(void* buffer, size_t buffer_len, size_t offset);
@@ -97,14 +99,10 @@ class File : public base::RefCounted<File> {
private:
bool init_;
bool mixed_;
-#ifdef WIN32
- HANDLE handle_; // Regular, asynchronous IO handle.
- HANDLE sync_handle_; // Synchronous IO hanlde.
-#else
- int file_descriptor_;
-#endif
-
- DISALLOW_EVIL_CONSTRUCTORS(File);
+ OSFile os_file_; // Regular, asynchronous IO handle.
+ OSFile sync_os_file_; // Synchronous IO hanlde.
+
+ DISALLOW_COPY_AND_ASSIGN(File);
};
} // namespace disk_cache