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> | 17 #include <string> |
18 | 18 |
19 #include "base/base_export.h" | 19 #include "base/base_export.h" |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
| 21 #include "base/files/platform_file.h" |
21 #include "base/files/scoped_file.h" | 22 #include "base/files/scoped_file.h" |
22 #include "base/move.h" | 23 #include "base/move.h" |
23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
24 | 25 |
25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
26 #include "base/win/scoped_handle.h" | 27 #include "base/win/scoped_handle.h" |
27 #endif | 28 #endif |
28 | 29 |
29 namespace base { | 30 namespace base { |
30 | 31 |
31 class FilePath; | 32 class FilePath; |
32 | 33 |
33 #if defined(OS_WIN) | 34 #if defined(OS_POSIX) |
34 typedef HANDLE PlatformFile; | |
35 #elif defined(OS_POSIX) | |
36 typedef int PlatformFile; | |
37 | |
38 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) | 35 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) |
39 typedef struct stat stat_wrapper_t; | 36 typedef struct stat stat_wrapper_t; |
40 #else | 37 #else |
41 typedef struct stat64 stat_wrapper_t; | 38 typedef struct stat64 stat_wrapper_t; |
42 #endif | 39 #endif |
43 #endif // defined(OS_POSIX) | 40 #endif |
44 | 41 |
45 // Thin wrapper around an OS-level file. | 42 // Thin wrapper around an OS-level file. |
46 // Note that this class does not provide any support for asynchronous IO, other | 43 // Note that this class does not provide any support for asynchronous IO, other |
47 // than the ability to create asynchronous handles on Windows. | 44 // than the ability to create asynchronous handles on Windows. |
48 // | 45 // |
49 // Note about const: this class does not attempt to determine if the underlying | 46 // Note about const: this class does not attempt to determine if the underlying |
50 // file system object is affected by a particular method in order to consider | 47 // file system object is affected by a particular method in order to consider |
51 // that method const or not. Only methods that deal with member variables in an | 48 // that method const or not. Only methods that deal with member variables in an |
52 // obvious non-modifying way are marked as const. Any method that forward calls | 49 // obvious non-modifying way are marked as const. Any method that forward calls |
53 // to the OS is not considered const, even if there is no apparent change to | 50 // to the OS is not considered const, even if there is no apparent change to |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 #endif | 301 #endif |
305 | 302 |
306 Error error_details_; | 303 Error error_details_; |
307 bool created_; | 304 bool created_; |
308 bool async_; | 305 bool async_; |
309 }; | 306 }; |
310 | 307 |
311 } // namespace base | 308 } // namespace base |
312 | 309 |
313 #endif // BASE_FILES_FILE_H_ | 310 #endif // BASE_FILES_FILE_H_ |
OLD | NEW |