Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

Side by Side Diff: base/files/memory_mapped_file.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/files/memory_mapped_file.h ('k') | base/files/memory_mapped_file_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 const MemoryMappedFile::Region MemoryMappedFile::Region::kWholeFile( 13 const MemoryMappedFile::Region MemoryMappedFile::Region::kWholeFile = {0, 0};
14 base::LINKER_INITIALIZED);
15
16 MemoryMappedFile::Region::Region(base::LinkerInitialized) : offset(0), size(0) {
17 }
18
19 MemoryMappedFile::Region::Region() : offset(-1), size(-1) {
20 }
21
22 MemoryMappedFile::Region::Region(int64 offset, int64 size)
23 : offset(offset), size(size) {
24 }
25 14
26 bool MemoryMappedFile::Region::operator==( 15 bool MemoryMappedFile::Region::operator==(
27 const MemoryMappedFile::Region& other) const { 16 const MemoryMappedFile::Region& other) const {
28 return other.offset == offset && other.size == size; 17 return other.offset == offset && other.size == size;
29 } 18 }
30 19
31 bool MemoryMappedFile::Region::operator!=( 20 bool MemoryMappedFile::Region::operator!=(
32 const MemoryMappedFile::Region& other) const { 21 const MemoryMappedFile::Region& other) const {
33 return other.offset != offset || other.size != size; 22 return other.offset != offset || other.size != size;
34 } 23 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Sadly, on Windows, the mmap alignment is not just equal to the page size. 82 // Sadly, on Windows, the mmap alignment is not just equal to the page size.
94 const int64 mask = static_cast<int64>(SysInfo::VMAllocationGranularity()) - 1; 83 const int64 mask = static_cast<int64>(SysInfo::VMAllocationGranularity()) - 1;
95 DCHECK_LT(mask, std::numeric_limits<int32>::max()); 84 DCHECK_LT(mask, std::numeric_limits<int32>::max());
96 *offset = start & mask; 85 *offset = start & mask;
97 *aligned_start = start & ~mask; 86 *aligned_start = start & ~mask;
98 *aligned_size = (size + *offset + mask) & ~mask; 87 *aligned_size = (size + *offset + mask) & ~mask;
99 } 88 }
100 #endif 89 #endif
101 90
102 } // namespace base 91 } // namespace base
OLDNEW
« no previous file with comments | « base/files/memory_mapped_file.h ('k') | base/files/memory_mapped_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698