diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 01:36:50 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-13 01:36:50 +0000 |
commit | 4e1c76f34b910c6e9a832cbac2e2bcce8acc9f52 (patch) | |
tree | c92007614f63d5eee9d1a7c85a5834f9603000fe /base/file_util.cc | |
parent | 3c5ed2c5747de75351c18fbf1e969eccc263d1d5 (diff) | |
download | chromium_src-4e1c76f34b910c6e9a832cbac2e2bcce8acc9f52.zip chromium_src-4e1c76f34b910c6e9a832cbac2e2bcce8acc9f52.tar.gz chromium_src-4e1c76f34b910c6e9a832cbac2e2bcce8acc9f52.tar.bz2 |
Use renderer spellchecker for windows.
BUG=25677
Review URL: http://codereview.chromium.org/372075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.cc')
-rw-r--r-- | base/file_util.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index 4cde773..8d1b517 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -267,6 +267,20 @@ MemoryMappedFile::~MemoryMappedFile() { CloseHandles(); } +bool MemoryMappedFile::Initialize(base::PlatformFile file) { + if (IsValid()) + return false; + + file_ = file; + + if (!MapFileToMemoryInternal()) { + CloseHandles(); + return false; + } + + return true; +} + bool MemoryMappedFile::Initialize(const FilePath& file_name) { if (IsValid()) return false; @@ -279,6 +293,19 @@ bool MemoryMappedFile::Initialize(const FilePath& file_name) { return true; } +bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) { + file_ = base::CreatePlatformFile(file_name, + base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, + NULL); + + if (file_ == base::kInvalidPlatformFileValue) { + LOG(ERROR) << "Couldn't open " << file_name.value(); + return false; + } + + return MapFileToMemoryInternal(); +} + bool MemoryMappedFile::IsValid() { return data_ != NULL; } |