| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #if defined(OS_POSIX) | 25 #if defined(OS_POSIX) |
| 26 #include <sys/stat.h> | 26 #include <sys/stat.h> |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| 30 | 30 |
| 31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 32 using PlatformFile = HANDLE; | 32 using PlatformFile = HANDLE; |
| 33 | 33 |
| 34 const PlatformFile kInvalidPlatformFile = INVALID_HANDLE_VALUE; | 34 const PlatformFile kInvalidPlatformFile = INVALID_HANDLE_VALUE; |
| 35 #elif defined(OS_POSIX) | 35 #elif defined(OS_POSIX) || defined(OS_FUCHSIA) |
| 36 using PlatformFile = int; | 36 using PlatformFile = int; |
| 37 | 37 |
| 38 const PlatformFile kInvalidPlatformFile = -1; | 38 const PlatformFile kInvalidPlatformFile = -1; |
| 39 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) | 39 #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) |
| 40 typedef struct stat stat_wrapper_t; | 40 typedef struct stat stat_wrapper_t; |
| 41 #else | 41 #else |
| 42 typedef struct stat64 stat_wrapper_t; | 42 typedef struct stat64 stat_wrapper_t; |
| 43 #endif | 43 #endif |
| 44 #endif // defined(OS_POSIX) | 44 #endif // defined(OS_POSIX) |
| 45 | 45 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 friend class FileTracing::ScopedTrace; | 350 friend class FileTracing::ScopedTrace; |
| 351 | 351 |
| 352 // Creates or opens the given file. Only called if |path| has no | 352 // Creates or opens the given file. Only called if |path| has no |
| 353 // traversal ('..') components. | 353 // traversal ('..') components. |
| 354 void DoInitialize(const FilePath& path, uint32_t flags); | 354 void DoInitialize(const FilePath& path, uint32_t flags); |
| 355 | 355 |
| 356 void SetPlatformFile(PlatformFile file); | 356 void SetPlatformFile(PlatformFile file); |
| 357 | 357 |
| 358 #if defined(OS_WIN) | 358 #if defined(OS_WIN) |
| 359 win::ScopedHandle file_; | 359 win::ScopedHandle file_; |
| 360 #elif defined(OS_POSIX) | 360 #elif defined(OS_POSIX) || defined(OS_FUCHSIA) |
| 361 ScopedFD file_; | 361 ScopedFD file_; |
| 362 #endif | 362 #endif |
| 363 | 363 |
| 364 // A path to use for tracing purposes. Set if file tracing is enabled during | 364 // A path to use for tracing purposes. Set if file tracing is enabled during |
| 365 // |Initialize()|. | 365 // |Initialize()|. |
| 366 FilePath tracing_path_; | 366 FilePath tracing_path_; |
| 367 | 367 |
| 368 // Object tied to the lifetime of |this| that enables/disables tracing. | 368 // Object tied to the lifetime of |this| that enables/disables tracing. |
| 369 FileTracing::ScopedEnabler trace_enabler_; | 369 FileTracing::ScopedEnabler trace_enabler_; |
| 370 | 370 |
| 371 Error error_details_; | 371 Error error_details_; |
| 372 bool created_; | 372 bool created_; |
| 373 bool async_; | 373 bool async_; |
| 374 | 374 |
| 375 DISALLOW_COPY_AND_ASSIGN(File); | 375 DISALLOW_COPY_AND_ASSIGN(File); |
| 376 }; | 376 }; |
| 377 | 377 |
| 378 } // namespace base | 378 } // namespace base |
| 379 | 379 |
| 380 #endif // BASE_FILES_FILE_H_ | 380 #endif // BASE_FILES_FILE_H_ |
| 381 | 381 |
| OLD | NEW |