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

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

Issue 1023103002: Let ImportantFileWriter Use fdatasync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | base/files/file_posix.cc » ('j') | base/files/file_posix.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 int WriteAtCurrentPosNoBestEffort(const char* data, int size); 246 int WriteAtCurrentPosNoBestEffort(const char* data, int size);
247 247
248 // Returns the current size of this file, or a negative number on failure. 248 // Returns the current size of this file, or a negative number on failure.
249 int64 GetLength(); 249 int64 GetLength();
250 250
251 // Truncates the file to the given length. If |length| is greater than the 251 // Truncates the file to the given length. If |length| is greater than the
252 // current size of the file, the file is extended with zeros. If the file 252 // current size of the file, the file is extended with zeros. If the file
253 // doesn't exist, |false| is returned. 253 // doesn't exist, |false| is returned.
254 bool SetLength(int64 length); 254 bool SetLength(int64 length);
255 255
256 // Instructs the filesystem to flush the file to disk. (POSIX: fsync, Windows: 256 // Instructs the filesystem to flush the file data and metadata to disk.
257 // FlushFileBuffers). 257 // (POSIX: fsync, Windows: FlushFileBuffers)
258 bool Flush(); 258 bool Flush();
259 259
260 // Instructs the filesystem to flush the file data to disk. Not necessarily
261 // flushes metadata like modification time.
262 // (Linux: fdatasync, other platforms: same as Flush())
rvargas (doing something else) 2015/03/20 18:56:05 I don't think we want to end up with two methods t
hashimoto 2015/03/20 19:38:56 Good point, I thought someone might be relying on
rvargas (doing something else) 2015/03/20 21:43:00 PSA sounds fine.
263 bool FlushData();
264
260 // Updates the file times. 265 // Updates the file times.
261 bool SetTimes(Time last_access_time, Time last_modified_time); 266 bool SetTimes(Time last_access_time, Time last_modified_time);
262 267
263 // Returns some basic information for the given file. 268 // Returns some basic information for the given file.
264 bool GetInfo(Info* info); 269 bool GetInfo(Info* info);
265 270
266 // Attempts to take an exclusive write lock on the file. Returns immediately 271 // Attempts to take an exclusive write lock on the file. Returns immediately
267 // (i.e. does not wait for another process to unlock the file). If the lock 272 // (i.e. does not wait for another process to unlock the file). If the lock
268 // was obtained, the result will be FILE_OK. A lock only guarantees 273 // was obtained, the result will be FILE_OK. A lock only guarantees
269 // that other processes may not also take a lock on the same file with the 274 // that other processes may not also take a lock on the same file with the
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 #endif 368 #endif
364 369
365 Error error_details_; 370 Error error_details_;
366 bool created_; 371 bool created_;
367 bool async_; 372 bool async_;
368 }; 373 };
369 374
370 } // namespace base 375 } // namespace base
371 376
372 #endif // BASE_FILES_FILE_H_ 377 #endif // BASE_FILES_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_posix.cc » ('j') | base/files/file_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698