OLD | NEW |
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 int WriteAtCurrentPosNoBestEffort(const char* data, int size); | 242 int WriteAtCurrentPosNoBestEffort(const char* data, int size); |
243 | 243 |
244 // Returns the current size of this file, or a negative number on failure. | 244 // Returns the current size of this file, or a negative number on failure. |
245 int64 GetLength(); | 245 int64 GetLength(); |
246 | 246 |
247 // Truncates the file to the given length. If |length| is greater than the | 247 // Truncates the file to the given length. If |length| is greater than the |
248 // current size of the file, the file is extended with zeros. If the file | 248 // current size of the file, the file is extended with zeros. If the file |
249 // doesn't exist, |false| is returned. | 249 // doesn't exist, |false| is returned. |
250 bool SetLength(int64 length); | 250 bool SetLength(int64 length); |
251 | 251 |
252 // Flushes the buffers. | 252 // Instructs the filesystem to flush the file to disk. (POSIX: fsync, Windows: |
| 253 // FlushFileBuffers). |
253 bool Flush(); | 254 bool Flush(); |
254 | 255 |
255 // Updates the file times. | 256 // Updates the file times. |
256 bool SetTimes(Time last_access_time, Time last_modified_time); | 257 bool SetTimes(Time last_access_time, Time last_modified_time); |
257 | 258 |
258 // Returns some basic information for the given file. | 259 // Returns some basic information for the given file. |
259 bool GetInfo(Info* info); | 260 bool GetInfo(Info* info); |
260 | 261 |
261 // Attempts to take an exclusive write lock on the file. Returns immediately | 262 // Attempts to take an exclusive write lock on the file. Returns immediately |
262 // (i.e. does not wait for another process to unlock the file). If the lock | 263 // (i.e. does not wait for another process to unlock the file). If the lock |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 #endif | 305 #endif |
305 | 306 |
306 Error error_details_; | 307 Error error_details_; |
307 bool created_; | 308 bool created_; |
308 bool async_; | 309 bool async_; |
309 }; | 310 }; |
310 | 311 |
311 } // namespace base | 312 } // namespace base |
312 | 313 |
313 #endif // BASE_FILES_FILE_H_ | 314 #endif // BASE_FILES_FILE_H_ |
OLD | NEW |