| 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> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void InitializeUnsafe(const FilePath& name, uint32 flags); | 165 void InitializeUnsafe(const FilePath& name, uint32 flags); |
| 166 | 166 |
| 167 bool IsValid() const; | 167 bool IsValid() const; |
| 168 | 168 |
| 169 // Returns true if a new file was created (or an old one truncated to zero | 169 // Returns true if a new file was created (or an old one truncated to zero |
| 170 // length to simulate a new file, which can happen with | 170 // length to simulate a new file, which can happen with |
| 171 // FLAG_CREATE_ALWAYS), and false otherwise. | 171 // FLAG_CREATE_ALWAYS), and false otherwise. |
| 172 bool created() const { return created_; } | 172 bool created() const { return created_; } |
| 173 | 173 |
| 174 // Returns the OS result of opening this file. | 174 // Returns the OS result of opening this file. |
| 175 Error error() const { return error_; } | 175 Error error_details() const { return error_details_; } |
| 176 | 176 |
| 177 PlatformFile GetPlatformFile() const { return file_; } | 177 PlatformFile GetPlatformFile() const { return file_; } |
| 178 PlatformFile TakePlatformFile(); | 178 PlatformFile TakePlatformFile(); |
| 179 | 179 |
| 180 // Destroying this object closes the file automatically. | 180 // Destroying this object closes the file automatically. |
| 181 void Close(); | 181 void Close(); |
| 182 | 182 |
| 183 // Changes current position in the file to an |offset| relative to an origin | 183 // Changes current position in the file to an |offset| relative to an origin |
| 184 // defined by |whence|. Returns the resultant current position in the file | 184 // defined by |whence|. Returns the resultant current position in the file |
| 185 // (relative to the start) or -1 in case of error. | 185 // (relative to the start) or -1 in case of error. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 private: | 270 private: |
| 271 void SetPlatformFile(PlatformFile file); | 271 void SetPlatformFile(PlatformFile file); |
| 272 | 272 |
| 273 #if defined(OS_WIN) | 273 #if defined(OS_WIN) |
| 274 win::ScopedHandle file_; | 274 win::ScopedHandle file_; |
| 275 #elif defined(OS_POSIX) | 275 #elif defined(OS_POSIX) |
| 276 PlatformFile file_; | 276 PlatformFile file_; |
| 277 #endif | 277 #endif |
| 278 | 278 |
| 279 Error error_; | 279 Error error_details_; |
| 280 bool created_; | 280 bool created_; |
| 281 bool async_; | 281 bool async_; |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 } // namespace base | 284 } // namespace base |
| 285 | 285 |
| 286 #endif // BASE_FILES_FILE_H_ | 286 #endif // BASE_FILES_FILE_H_ |
| OLD | NEW |