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

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

Issue 428883012: Add LINKER_INITIALIZER marker to MemoryMappedFile::Region::kWholeFile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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') | no next file » | 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(
14 base::LINKER_INITIALIZED);
14 15
15 MemoryMappedFile::Region::Region() : offset(0), size(0) { 16 MemoryMappedFile::Region::Region(base::LinkerInitialized) : offset(0), size(0) {
16 } 17 }
17 18
18 MemoryMappedFile::Region::Region(int64 offset, int64 size) 19 MemoryMappedFile::Region::Region(int64 offset, int64 size)
19 : offset(offset), size(size) { 20 : offset(offset), size(size) {
20 DCHECK_GE(offset, 0); 21 DCHECK_GE(offset, 0);
21 DCHECK_GT(size, 0); 22 DCHECK_GT(size, 0);
22 } 23 }
23 24
24 bool MemoryMappedFile::Region::operator==( 25 bool MemoryMappedFile::Region::operator==(
25 const MemoryMappedFile::Region& other) const { 26 const MemoryMappedFile::Region& other) const {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int32* offset) { 80 int32* offset) {
80 // Sadly, on Windows, the mmap alignment is not just equal to the page size. 81 // Sadly, on Windows, the mmap alignment is not just equal to the page size.
81 const int64 mask = static_cast<int64>(SysInfo::VMAllocationGranularity()) - 1; 82 const int64 mask = static_cast<int64>(SysInfo::VMAllocationGranularity()) - 1;
82 DCHECK_LT(mask, std::numeric_limits<int32>::max()); 83 DCHECK_LT(mask, std::numeric_limits<int32>::max());
83 *offset = start & mask; 84 *offset = start & mask;
84 *aligned_start = start & ~mask; 85 *aligned_start = start & ~mask;
85 *aligned_size = (size + *offset + mask) & ~mask; 86 *aligned_size = (size + *offset + mask) & ~mask;
86 } 87 }
87 88
88 } // namespace base 89 } // namespace base
OLDNEW
« no previous file with comments | « base/files/memory_mapped_file.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698