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

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

Issue 394313002: Add support for loading pak files from arbitrary file regions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove IsWholeFile, use kWholeFile; other nits Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FILE_H_ 5 #ifndef BASE_FILES_FILE_H_
6 #define BASE_FILES_FILE_H_ 6 #define BASE_FILES_FILE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // The last modified time of a file. 148 // The last modified time of a file.
149 base::Time last_modified; 149 base::Time last_modified;
150 150
151 // The last accessed time of a file. 151 // The last accessed time of a file.
152 base::Time last_accessed; 152 base::Time last_accessed;
153 153
154 // The creation time of a file. 154 // The creation time of a file.
155 base::Time creation_time; 155 base::Time creation_time;
156 }; 156 };
157 157
158 // Used to hold information about a region [offset + size] of a file.
159 struct BASE_EXPORT Region {
160 static const Region kWholeFile;
161
162 Region(int64 offset, int64 size);
163
164 bool operator==(const Region& other) const;
165
166 // Start of the region (measured in bytes from the beginning of the file).
167 int64 offset;
Primiano Tucci (use gerrit) 2014/07/23 23:17:38 I'm a bit on the fence of this, w.r.t. keeping the
willchan no longer on Chromium 2014/07/25 21:21:23 I think Region should be a dumb struct. Whatever f
168
169 // Length of the region in bytes.
170 int64 size;
171
172 private:
173 // This ctor is used only by kWholeFile, to construct a zero-sized Region
174 // (which is forbidden by the public ctor) and uniquely identify kWholeFile.
175 Region();
176 };
177
158 File(); 178 File();
159 179
160 // Creates or opens the given file. This will fail with 'access denied' if the 180 // Creates or opens the given file. This will fail with 'access denied' if the
161 // |name| contains path traversal ('..') components. 181 // |name| contains path traversal ('..') components.
162 File(const FilePath& name, uint32 flags); 182 File(const FilePath& name, uint32 flags);
163 183
164 // Takes ownership of |platform_file|. 184 // Takes ownership of |platform_file|.
165 explicit File(PlatformFile platform_file); 185 explicit File(PlatformFile platform_file);
166 186
167 // Creates an object with a specific error_details code. 187 // Creates an object with a specific error_details code.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 #endif 324 #endif
305 325
306 Error error_details_; 326 Error error_details_;
307 bool created_; 327 bool created_;
308 bool async_; 328 bool async_;
309 }; 329 };
310 330
311 } // namespace base 331 } // namespace base
312 332
313 #endif // BASE_FILES_FILE_H_ 333 #endif // BASE_FILES_FILE_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/files/file.cc » ('j') | base/files/file.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698