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 #include "base/files/file.h" | 5 #include "base/files/file.h" |
6 | 6 |
7 #include <io.h> | 7 #include <io.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 (::SetFilePointerEx(file_.Get(), file_pointer, NULL, FILE_BEGIN) != | 255 (::SetFilePointerEx(file_.Get(), file_pointer, NULL, FILE_BEGIN) != |
256 FALSE)); | 256 FALSE)); |
257 } | 257 } |
258 | 258 |
259 bool File::Flush() { | 259 bool File::Flush() { |
260 base::ThreadRestrictions::AssertIOAllowed(); | 260 base::ThreadRestrictions::AssertIOAllowed(); |
261 DCHECK(IsValid()); | 261 DCHECK(IsValid()); |
262 return ::FlushFileBuffers(file_.Get()) != FALSE; | 262 return ::FlushFileBuffers(file_.Get()) != FALSE; |
263 } | 263 } |
264 | 264 |
| 265 bool File::FlushData() { |
| 266 return Flush(); |
| 267 } |
| 268 |
265 bool File::SetTimes(Time last_access_time, Time last_modified_time) { | 269 bool File::SetTimes(Time last_access_time, Time last_modified_time) { |
266 base::ThreadRestrictions::AssertIOAllowed(); | 270 base::ThreadRestrictions::AssertIOAllowed(); |
267 DCHECK(IsValid()); | 271 DCHECK(IsValid()); |
268 | 272 |
269 FILETIME last_access_filetime = last_access_time.ToFileTime(); | 273 FILETIME last_access_filetime = last_access_time.ToFileTime(); |
270 FILETIME last_modified_filetime = last_modified_time.ToFileTime(); | 274 FILETIME last_modified_filetime = last_modified_time.ToFileTime(); |
271 return (::SetFileTime(file_.Get(), NULL, &last_access_filetime, | 275 return (::SetFileTime(file_.Get(), NULL, &last_access_filetime, |
272 &last_modified_filetime) != FALSE); | 276 &last_modified_filetime) != FALSE); |
273 } | 277 } |
274 | 278 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 last_error); | 370 last_error); |
367 return FILE_ERROR_FAILED; | 371 return FILE_ERROR_FAILED; |
368 } | 372 } |
369 } | 373 } |
370 | 374 |
371 void File::SetPlatformFile(PlatformFile file) { | 375 void File::SetPlatformFile(PlatformFile file) { |
372 file_.Set(file); | 376 file_.Set(file); |
373 } | 377 } |
374 | 378 |
375 } // namespace base | 379 } // namespace base |
OLD | NEW |