| 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> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #if defined(OS_POSIX) | 13 #if defined(OS_POSIX) |
| 14 #include <sys/stat.h> | 14 #include <sys/stat.h> |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #include <string> |
| 18 |
| 17 #include "base/base_export.h" | 19 #include "base/base_export.h" |
| 18 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
| 19 #include "base/files/scoped_file.h" | 21 #include "base/files/scoped_file.h" |
| 20 #include "base/move.h" | 22 #include "base/move.h" |
| 21 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 22 | 24 |
| 23 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 24 #include "base/win/scoped_handle.h" | 26 #include "base/win/scoped_handle.h" |
| 25 #endif | 27 #endif |
| 26 | 28 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 Error Unlock(); | 284 Error Unlock(); |
| 283 | 285 |
| 284 bool async() const { return async_; } | 286 bool async() const { return async_; } |
| 285 | 287 |
| 286 #if defined(OS_WIN) | 288 #if defined(OS_WIN) |
| 287 static Error OSErrorToFileError(DWORD last_error); | 289 static Error OSErrorToFileError(DWORD last_error); |
| 288 #elif defined(OS_POSIX) | 290 #elif defined(OS_POSIX) |
| 289 static Error OSErrorToFileError(int saved_errno); | 291 static Error OSErrorToFileError(int saved_errno); |
| 290 #endif | 292 #endif |
| 291 | 293 |
| 294 // Converts an error value to a human-readable form. Used for logging. |
| 295 static std::string ErrorToString(Error error); |
| 296 |
| 292 private: | 297 private: |
| 293 void SetPlatformFile(PlatformFile file); | 298 void SetPlatformFile(PlatformFile file); |
| 294 | 299 |
| 295 #if defined(OS_WIN) | 300 #if defined(OS_WIN) |
| 296 win::ScopedHandle file_; | 301 win::ScopedHandle file_; |
| 297 #elif defined(OS_POSIX) | 302 #elif defined(OS_POSIX) |
| 298 ScopedFD file_; | 303 ScopedFD file_; |
| 299 #endif | 304 #endif |
| 300 | 305 |
| 301 Error error_details_; | 306 Error error_details_; |
| 302 bool created_; | 307 bool created_; |
| 303 bool async_; | 308 bool async_; |
| 304 }; | 309 }; |
| 305 | 310 |
| 306 } // namespace base | 311 } // namespace base |
| 307 | 312 |
| 308 #endif // BASE_FILES_FILE_H_ | 313 #endif // BASE_FILES_FILE_H_ |
| OLD | NEW |