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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 Error Lock(); | 283 Error Lock(); |
284 | 284 |
285 // Unlock a file previously locked. | 285 // Unlock a file previously locked. |
286 Error Unlock(); | 286 Error Unlock(); |
287 | 287 |
288 // Returns a new object referencing this file for use within the current | 288 // Returns a new object referencing this file for use within the current |
289 // process. Handling of FLAG_DELETE_ON_CLOSE varies by OS. On POSIX, the File | 289 // process. Handling of FLAG_DELETE_ON_CLOSE varies by OS. On POSIX, the File |
290 // object that was created or initialized with this flag will have unlinked | 290 // object that was created or initialized with this flag will have unlinked |
291 // the underlying file when it was created or opened. On Windows, the | 291 // the underlying file when it was created or opened. On Windows, the |
292 // underlying file is deleted when the last handle to it is closed. | 292 // underlying file is deleted when the last handle to it is closed. |
293 File Duplicate(); | 293 File Duplicate() const; |
294 | 294 |
295 bool async() const { return async_; } | 295 bool async() const { return async_; } |
296 | 296 |
297 #if defined(OS_WIN) | 297 #if defined(OS_WIN) |
298 static Error OSErrorToFileError(DWORD last_error); | 298 static Error OSErrorToFileError(DWORD last_error); |
299 #elif defined(OS_POSIX) | 299 #elif defined(OS_POSIX) |
300 static Error OSErrorToFileError(int saved_errno); | 300 static Error OSErrorToFileError(int saved_errno); |
301 #endif | 301 #endif |
302 | 302 |
303 // Converts an error value to a human-readable form. Used for logging. | 303 // Converts an error value to a human-readable form. Used for logging. |
(...skipping 29 matching lines...) Expand all Loading... |
333 bool created_; | 333 bool created_; |
334 bool async_; | 334 bool async_; |
335 | 335 |
336 DISALLOW_COPY_AND_ASSIGN(File); | 336 DISALLOW_COPY_AND_ASSIGN(File); |
337 }; | 337 }; |
338 | 338 |
339 } // namespace base | 339 } // namespace base |
340 | 340 |
341 #endif // BASE_FILES_FILE_H_ | 341 #endif // BASE_FILES_FILE_H_ |
342 | 342 |
OLD | NEW |