summaryrefslogtreecommitdiffstats
path: root/base/file_util.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-16 22:55:17 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-16 22:55:17 +0000
commitcb6037d67847a6341eea166baf1d4051667a0b88 (patch)
tree2b766762057e96d758385b96e2a576d7b6690d54 /base/file_util.h
parentf9be34d622561d5599603b41d1c43d595e503426 (diff)
downloadchromium_src-cb6037d67847a6341eea166baf1d4051667a0b88.zip
chromium_src-cb6037d67847a6341eea166baf1d4051667a0b88.tar.gz
chromium_src-cb6037d67847a6341eea166baf1d4051667a0b88.tar.bz2
reland 31875. Revert was:
------ Revert 31875 to see whether it fixes reliability bot. BUG=25677 TEST=None ------ TBR=huanr Review URL: http://codereview.chromium.org/397017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r--base/file_util.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/base/file_util.h b/base/file_util.h
index 8654e62..782a6a2 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -24,6 +24,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/platform_file.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/time.h"
@@ -490,10 +491,9 @@ class MemoryMappedFile {
// the file does not exist, or the memory mapping fails, it will return false.
// Later we may want to allow the user to specify access.
bool Initialize(const FilePath& file_name);
-#if defined(OS_POSIX)
- // As above, but works with an alreay-opened file.
- bool Initialize(const base::FileDescriptor& fd);
-#endif
+ // As above, but works with an already-opened file. MemoryMappedFile will take
+ // ownership of |file| and close it when done.
+ bool Initialize(base::PlatformFile file);
const uint8* data() const { return data_; }
size_t length() const { return length_; }
@@ -502,23 +502,19 @@ class MemoryMappedFile {
bool IsValid();
private:
- // Map the file to memory, set data_ to that memory address. Return true on
- // success, false on any kind of failure. This is a helper for Initialize().
+ // Open the given file and pass it to MapFileToMemoryInternal().
bool MapFileToMemory(const FilePath& file_name);
-#if defined(OS_POSIX)
+ // Map the file to memory, set data_ to that memory address. Return true on
+ // success, false on any kind of failure. This is a helper for Initialize().
bool MapFileToMemoryInternal();
-#endif
// Closes all open handles. Later we may want to make this public.
void CloseHandles();
+ base::PlatformFile file_;
#if defined(OS_WIN)
- HANDLE file_;
HANDLE file_mapping_;
-#elif defined(OS_POSIX)
- // The file descriptor.
- base::FileDescriptor file_;
#endif
uint8* data_;
size_t length_;