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 <string> | |
rvargas (doing something else)
2014/05/29 19:07:27
nit: This should go after <windows> and <sys/stat.
mtomasz
2014/05/30 00:25:55
Done.
| |
9 | |
8 #include "build/build_config.h" | 10 #include "build/build_config.h" |
9 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
10 #include <windows.h> | 12 #include <windows.h> |
11 #endif | 13 #endif |
12 | 14 |
13 #if defined(OS_POSIX) | 15 #if defined(OS_POSIX) |
14 #include <sys/stat.h> | 16 #include <sys/stat.h> |
15 #endif | 17 #endif |
16 | 18 |
17 #include "base/base_export.h" | 19 #include "base/base_export.h" |
(...skipping 264 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 |