OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/files/memory_mapped_file.h" | 5 #include "base/files/memory_mapped_file.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
7 #include <sys/mman.h> | 9 #include <sys/mman.h> |
8 #include <sys/stat.h> | 10 #include <sys/stat.h> |
9 #include <unistd.h> | 11 #include <unistd.h> |
10 | 12 |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "build/build_config.h" |
13 | 16 |
14 namespace base { | 17 namespace base { |
15 | 18 |
16 MemoryMappedFile::MemoryMappedFile() : data_(NULL), length_(0) { | 19 MemoryMappedFile::MemoryMappedFile() : data_(NULL), length_(0) { |
17 } | 20 } |
18 | 21 |
19 #if !defined(OS_NACL) | 22 #if !defined(OS_NACL) |
20 bool MemoryMappedFile::MapFileRegionToMemory( | 23 bool MemoryMappedFile::MapFileRegionToMemory( |
21 const MemoryMappedFile::Region& region) { | 24 const MemoryMappedFile::Region& region) { |
22 ThreadRestrictions::AssertIOAllowed(); | 25 ThreadRestrictions::AssertIOAllowed(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 82 |
80 if (data_ != NULL) | 83 if (data_ != NULL) |
81 munmap(data_, length_); | 84 munmap(data_, length_); |
82 file_.Close(); | 85 file_.Close(); |
83 | 86 |
84 data_ = NULL; | 87 data_ = NULL; |
85 length_ = 0; | 88 length_ = 0; |
86 } | 89 } |
87 | 90 |
88 } // namespace base | 91 } // namespace base |
OLD | NEW |