summaryrefslogtreecommitdiffstats
path: root/base/file_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/file_util.cc')
-rw-r--r--base/file_util.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index d1a46c9..c9661e7 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -315,13 +315,11 @@ MemoryMappedFile::~MemoryMappedFile() {
CloseHandles();
}
-bool MemoryMappedFile::Initialize(base::PlatformFile file) {
+bool MemoryMappedFile::Initialize(const FilePath& file_name) {
if (IsValid())
return false;
- file_ = file;
-
- if (!MapFileToMemoryInternal()) {
+ if (!MapFileToMemory(file_name)) {
CloseHandles();
return false;
}
@@ -329,11 +327,13 @@ bool MemoryMappedFile::Initialize(base::PlatformFile file) {
return true;
}
-bool MemoryMappedFile::Initialize(const FilePath& file_name) {
+bool MemoryMappedFile::Initialize(base::PlatformFile file) {
if (IsValid())
return false;
- if (!MapFileToMemory(file_name)) {
+ file_ = file;
+
+ if (!MapFileToMemoryInternal()) {
CloseHandles();
return false;
}
@@ -341,6 +341,10 @@ bool MemoryMappedFile::Initialize(const FilePath& file_name) {
return true;
}
+bool MemoryMappedFile::IsValid() {
+ return data_ != NULL;
+}
+
bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
file_ = base::CreatePlatformFile(
file_name, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
@@ -354,10 +358,6 @@ bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
return MapFileToMemoryInternal();
}
-bool MemoryMappedFile::IsValid() {
- return data_ != NULL;
-}
-
// Deprecated functions ----------------------------------------------------
#if defined(OS_WIN)