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_PLATFORM_FILE_H_ | 5 #ifndef BASE_PLATFORM_FILE_H_ |
6 #define BASE_PLATFORM_FILE_H_ | 6 #define BASE_PLATFORM_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> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 base::Time creation_time; | 115 base::Time creation_time; |
116 }; | 116 }; |
117 | 117 |
118 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
119 typedef HANDLE PlatformFile; | 119 typedef HANDLE PlatformFile; |
120 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; | 120 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; |
121 PlatformFileError LastErrorToPlatformFileError(DWORD saved_errno); | 121 PlatformFileError LastErrorToPlatformFileError(DWORD saved_errno); |
122 #elif defined(OS_POSIX) | 122 #elif defined(OS_POSIX) |
123 typedef int PlatformFile; | 123 typedef int PlatformFile; |
124 const PlatformFile kInvalidPlatformFileValue = -1; | 124 const PlatformFile kInvalidPlatformFileValue = -1; |
125 PlatformFileError ErrnoToPlatformFileError(int saved_errno); | 125 BASE_EXPORT PlatformFileError ErrnoToPlatformFileError(int saved_errno); |
126 #endif | 126 #endif |
127 | 127 |
128 // Creates or opens the given file. If |created| is provided, it will be set to | 128 // Creates or opens the given file. If |created| is provided, it will be set to |
129 // true if a new file was created [or an old one truncated to zero length to | 129 // true if a new file was created [or an old one truncated to zero length to |
130 // simulate a new file, which can happen with PLATFORM_FILE_CREATE_ALWAYS], and | 130 // simulate a new file, which can happen with PLATFORM_FILE_CREATE_ALWAYS], and |
131 // false otherwise. |error| can be NULL. | 131 // false otherwise. |error| can be NULL. |
132 // | 132 // |
133 // This function fails with 'access denied' if the |name| contains path | 133 // This function fails with 'access denied' if the |name| contains path |
134 // traversal ('..') components. | 134 // traversal ('..') components. |
135 BASE_EXPORT PlatformFile CreatePlatformFile(const FilePath& name, | 135 BASE_EXPORT PlatformFile CreatePlatformFile(const FilePath& name, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 return temp; | 271 return temp; |
272 } | 272 } |
273 | 273 |
274 private: | 274 private: |
275 PlatformFile* value_; | 275 PlatformFile* value_; |
276 }; | 276 }; |
277 | 277 |
278 } // namespace base | 278 } // namespace base |
279 | 279 |
280 #endif // BASE_PLATFORM_FILE_H_ | 280 #endif // BASE_PLATFORM_FILE_H_ |
OLD | NEW |