| Index: base/file_util_win.cc
|
| ===================================================================
|
| --- base/file_util_win.cc (revision 6940)
|
| +++ base/file_util_win.cc (working copy)
|
| @@ -704,22 +704,6 @@
|
| 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 @@
|
| if (file_mapping_ == INVALID_HANDLE_VALUE)
|
| return false;
|
|
|
| - data_ = reinterpret_cast<const uint8*>(
|
| + data_ = static_cast<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_);
|
|
|