Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: base/file_util.h

Issue 496007: Make ProcessWatcher use kqueues on Mac. (Closed)
Patch Set: No need for a thread Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/base.gypi ('k') | base/time.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 public: 364 public:
365 inline void operator()(FILE* x) const { 365 inline void operator()(FILE* x) const {
366 if (x) { 366 if (x) {
367 fclose(x); 367 fclose(x);
368 } 368 }
369 } 369 }
370 }; 370 };
371 371
372 typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE; 372 typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE;
373 373
374 #if defined(OS_POSIX)
375 // A class to handle auto-closing of FDs.
376 class ScopedFDClose {
377 public:
378 inline void operator()(int* x) const {
379 if (x) {
380 close(*x);
381 }
382 }
383 };
384
385 typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD;
386 #endif // OS_POSIX
387
374 // A class for enumerating the files in a provided path. The order of the 388 // A class for enumerating the files in a provided path. The order of the
375 // results is not guaranteed. 389 // results is not guaranteed.
376 // 390 //
377 // DO NOT USE FROM THE MAIN THREAD of your application unless it is a test 391 // DO NOT USE FROM THE MAIN THREAD of your application unless it is a test
378 // program where latency does not matter. This class is blocking. 392 // program where latency does not matter. This class is blocking.
379 class FileEnumerator { 393 class FileEnumerator {
380 public: 394 public:
381 #if defined(OS_WIN) 395 #if defined(OS_WIN)
382 typedef WIN32_FIND_DATA FindInfo; 396 typedef WIN32_FIND_DATA FindInfo;
383 #elif defined(OS_POSIX) 397 #elif defined(OS_POSIX)
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 const FilePath& source_file_path, 543 const FilePath& source_file_path,
530 const FilePath& target_file_path); 544 const FilePath& target_file_path);
531 545
532 // Returns whether the file has been modified since a particular date. 546 // Returns whether the file has been modified since a particular date.
533 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, 547 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
534 const base::Time& cutoff_time); 548 const base::Time& cutoff_time);
535 549
536 } // namespace file_util 550 } // namespace file_util
537 551
538 #endif // BASE_FILE_UTIL_H_ 552 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698