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

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

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/file_win.cc ('k') | base/files/memory_mapped_file.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 #ifndef BASE_FILES_MEMORY_MAPPED_FILE_H_ 5 #ifndef BASE_FILES_MEMORY_MAPPED_FILE_H_
6 #define BASE_FILES_MEMORY_MAPPED_FILE_H_ 6 #define BASE_FILES_MEMORY_MAPPED_FILE_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 10 matching lines...) Expand all
21 class BASE_EXPORT MemoryMappedFile { 21 class BASE_EXPORT MemoryMappedFile {
22 public: 22 public:
23 // The default constructor sets all members to invalid/null values. 23 // The default constructor sets all members to invalid/null values.
24 MemoryMappedFile(); 24 MemoryMappedFile();
25 ~MemoryMappedFile(); 25 ~MemoryMappedFile();
26 26
27 // Used to hold information about a region [offset + size] of a file. 27 // Used to hold information about a region [offset + size] of a file.
28 struct BASE_EXPORT Region { 28 struct BASE_EXPORT Region {
29 static const Region kWholeFile; 29 static const Region kWholeFile;
30 30
31 Region();
32 Region(int64 offset, int64 size);
33
34 bool operator==(const Region& other) const; 31 bool operator==(const Region& other) const;
35 bool operator!=(const Region& other) const; 32 bool operator!=(const Region& other) const;
36 33
37 // Start of the region (measured in bytes from the beginning of the file). 34 // Start of the region (measured in bytes from the beginning of the file).
38 int64 offset; 35 int64 offset;
39 36
40 // Length of the region in bytes. 37 // Length of the region in bytes.
41 int64 size; 38 int64 size;
42
43 private:
44 // Used by kWholeFile.
45 Region(base::LinkerInitialized);
46 }; 39 };
47 40
48 // Opens an existing file and maps it into memory. Access is restricted to 41 // Opens an existing file and maps it into memory. Access is restricted to
49 // read only. If this object already points to a valid memory mapped file 42 // read only. If this object already points to a valid memory mapped file
50 // then this method will fail and return false. If it cannot open the file, 43 // then this method will fail and return false. If it cannot open the file,
51 // the file does not exist, or the memory mapping fails, it will return false. 44 // the file does not exist, or the memory mapping fails, it will return false.
52 // Later we may want to allow the user to specify access. 45 // Later we may want to allow the user to specify access.
53 bool Initialize(const FilePath& file_name); 46 bool Initialize(const FilePath& file_name);
54 47
55 // As above, but works with an already-opened file. MemoryMappedFile takes 48 // As above, but works with an already-opened file. MemoryMappedFile takes
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 win::ScopedHandle file_mapping_; 92 win::ScopedHandle file_mapping_;
100 bool image_; // Map as an image. 93 bool image_; // Map as an image.
101 #endif 94 #endif
102 95
103 DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile); 96 DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile);
104 }; 97 };
105 98
106 } // namespace base 99 } // namespace base
107 100
108 #endif // BASE_FILES_MEMORY_MAPPED_FILE_H_ 101 #endif // BASE_FILES_MEMORY_MAPPED_FILE_H_
OLDNEW
« no previous file with comments | « base/files/file_win.cc ('k') | base/files/memory_mapped_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698