summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 22:05:23 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 22:05:23 +0000
commitcf0d278d5ad746f025a7cf687dcc019b4c09421e (patch)
tree0b0b4627d132e56a7230ab07a4d98c5064359d5e /base/file_util_win.cc
parent620b79cee22f6376851f63989e319157f23d5556 (diff)
downloadchromium_src-cf0d278d5ad746f025a7cf687dcc019b4c09421e.zip
chromium_src-cf0d278d5ad746f025a7cf687dcc019b4c09421e.tar.gz
chromium_src-cf0d278d5ad746f025a7cf687dcc019b4c09421e.tar.bz2
Implement the memory mapped file class for posix.
Review URL: http://codereview.chromium.org/14073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc22
1 files changed, 1 insertions, 21 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index c287129..b674910 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -704,22 +704,6 @@ MemoryMappedFile::MemoryMappedFile()
length_(INVALID_FILE_SIZE) {
}
-MemoryMappedFile::~MemoryMappedFile() {
- CloseHandles();
-}
-
-bool MemoryMappedFile::Initialize(const FilePath& file_name) {
- if (IsValid())
- return false;
-
- if (!MapFileToMemory(file_name)) {
- CloseHandles();
- return false;
- }
-
- return true;
-}
-
bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
file_ = ::CreateFile(file_name.value().c_str(), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
@@ -736,15 +720,11 @@ bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
if (file_mapping_ == INVALID_HANDLE_VALUE)
return false;
- data_ = reinterpret_cast<const uint8*>(
+ data_ = static_cast<const uint8*>(
::MapViewOfFile(file_mapping_, FILE_MAP_READ, 0, 0, length_));
return data_ != NULL;
}
-bool MemoryMappedFile::IsValid() {
- return data_ != NULL;
-}
-
void MemoryMappedFile::CloseHandles() {
if (data_)
::UnmapViewOfFile(data_);