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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
| 12 #include "build/build_config.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 | 15 |
15 const MemoryMappedFile::Region MemoryMappedFile::Region::kWholeFile = {0, 0}; | 16 const MemoryMappedFile::Region MemoryMappedFile::Region::kWholeFile = {0, 0}; |
16 | 17 |
17 bool MemoryMappedFile::Region::operator==( | 18 bool MemoryMappedFile::Region::operator==( |
18 const MemoryMappedFile::Region& other) const { | 19 const MemoryMappedFile::Region& other) const { |
19 return other.offset == offset && other.size == size; | 20 return other.offset == offset && other.size == size; |
20 } | 21 } |
21 | 22 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const int64_t mask = | 86 const int64_t mask = |
86 static_cast<int64_t>(SysInfo::VMAllocationGranularity()) - 1; | 87 static_cast<int64_t>(SysInfo::VMAllocationGranularity()) - 1; |
87 DCHECK_LT(mask, std::numeric_limits<int32_t>::max()); | 88 DCHECK_LT(mask, std::numeric_limits<int32_t>::max()); |
88 *offset = start & mask; | 89 *offset = start & mask; |
89 *aligned_start = start & ~mask; | 90 *aligned_start = start & ~mask; |
90 *aligned_size = (size + *offset + mask) & ~mask; | 91 *aligned_size = (size + *offset + mask) & ~mask; |
91 } | 92 } |
92 #endif | 93 #endif |
93 | 94 |
94 } // namespace base | 95 } // namespace base |
OLD | NEW |