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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 BASE_EXPORT bool FlushPlatformFile(PlatformFile file); | 197 BASE_EXPORT bool FlushPlatformFile(PlatformFile file); |
198 | 198 |
199 // Touches the given file. | 199 // Touches the given file. |
200 BASE_EXPORT bool TouchPlatformFile(PlatformFile file, | 200 BASE_EXPORT bool TouchPlatformFile(PlatformFile file, |
201 const Time& last_access_time, | 201 const Time& last_access_time, |
202 const Time& last_modified_time); | 202 const Time& last_modified_time); |
203 | 203 |
204 // Returns some information for the given file. | 204 // Returns some information for the given file. |
205 BASE_EXPORT bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info); | 205 BASE_EXPORT bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info); |
206 | 206 |
| 207 #if defined(OS_WIN) |
| 208 PlatformFileError LastErrorToPlatformFileError(DWORD saved_errno); |
| 209 #elif defined(OS_POSIX) |
| 210 PlatformFileError ErrnoToPlatformFileError(int saved_errno); |
| 211 #endif |
| 212 |
207 // Use this class to pass ownership of a PlatformFile to a receiver that may or | 213 // Use this class to pass ownership of a PlatformFile to a receiver that may or |
208 // may not want to accept it. This class does not own the storage for the | 214 // may not want to accept it. This class does not own the storage for the |
209 // PlatformFile. | 215 // PlatformFile. |
210 // | 216 // |
211 // EXAMPLE: | 217 // EXAMPLE: |
212 // | 218 // |
213 // void MaybeProcessFile(PassPlatformFile pass_file) { | 219 // void MaybeProcessFile(PassPlatformFile pass_file) { |
214 // if (...) { | 220 // if (...) { |
215 // PlatformFile file = pass_file.ReleaseValue(); | 221 // PlatformFile file = pass_file.ReleaseValue(); |
216 // // Now, we are responsible for closing |file|. | 222 // // Now, we are responsible for closing |file|. |
(...skipping 21 matching lines...) Expand all Loading... |
238 return temp; | 244 return temp; |
239 } | 245 } |
240 | 246 |
241 private: | 247 private: |
242 PlatformFile* value_; | 248 PlatformFile* value_; |
243 }; | 249 }; |
244 | 250 |
245 } // namespace base | 251 } // namespace base |
246 | 252 |
247 #endif // BASE_PLATFORM_FILE_H_ | 253 #endif // BASE_PLATFORM_FILE_H_ |
OLD | NEW |