| 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 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
| 6 // filesystem. | 6 // filesystem. |
| 7 | 7 |
| 8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
| 9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
| 10 | 10 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 }; | 391 }; |
| 392 | 392 |
| 393 typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE; | 393 typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE; |
| 394 | 394 |
| 395 #if defined(OS_POSIX) | 395 #if defined(OS_POSIX) |
| 396 // A class to handle auto-closing of FDs. | 396 // A class to handle auto-closing of FDs. |
| 397 class ScopedFDClose { | 397 class ScopedFDClose { |
| 398 public: | 398 public: |
| 399 inline void operator()(int* x) const { | 399 inline void operator()(int* x) const { |
| 400 if (x && *x >= 0) { | 400 if (x && *x >= 0) { |
| 401 if (HANDLE_EINTR(close(*x)) < 0) | 401 if (IGNORE_EINTR(close(*x)) < 0) |
| 402 DPLOG(ERROR) << "close"; | 402 DPLOG(ERROR) << "close"; |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 }; | 405 }; |
| 406 | 406 |
| 407 typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD; | 407 typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD; |
| 408 #endif // OS_POSIX | 408 #endif // OS_POSIX |
| 409 | 409 |
| 410 #if defined(OS_LINUX) | 410 #if defined(OS_LINUX) |
| 411 // Broad categories of file systems as returned by statfs() on Linux. | 411 // Broad categories of file systems as returned by statfs() on Linux. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // This function simulates Move(), but unlike Move() it works across volumes. | 451 // This function simulates Move(), but unlike Move() it works across volumes. |
| 452 // This function is not transactional. | 452 // This function is not transactional. |
| 453 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 453 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 454 const FilePath& to_path); | 454 const FilePath& to_path); |
| 455 #endif // defined(OS_WIN) | 455 #endif // defined(OS_WIN) |
| 456 | 456 |
| 457 } // namespace internal | 457 } // namespace internal |
| 458 } // namespace base | 458 } // namespace base |
| 459 | 459 |
| 460 #endif // BASE_FILE_UTIL_H_ | 460 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |