OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 static void GetApplicationName(std::string* application) { | 402 static void GetApplicationName(std::string* application) { |
403 EnsureDefaultFilesystem()->GetApplicationName(application); | 403 EnsureDefaultFilesystem()->GetApplicationName(application); |
404 } | 404 } |
405 | 405 |
406 private: | 406 private: |
407 static FilesystemInterface* default_filesystem_; | 407 static FilesystemInterface* default_filesystem_; |
408 | 408 |
409 static FilesystemInterface *EnsureDefaultFilesystem(); | 409 static FilesystemInterface *EnsureDefaultFilesystem(); |
410 DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); | 410 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); |
411 }; | 411 }; |
412 | 412 |
413 class FilesystemScope{ | 413 class FilesystemScope{ |
414 public: | 414 public: |
415 explicit FilesystemScope(FilesystemInterface *new_fs) { | 415 explicit FilesystemScope(FilesystemInterface *new_fs) { |
416 old_fs_ = Filesystem::swap_default_filesystem(new_fs); | 416 old_fs_ = Filesystem::swap_default_filesystem(new_fs); |
417 } | 417 } |
418 ~FilesystemScope() { | 418 ~FilesystemScope() { |
419 Filesystem::set_default_filesystem(old_fs_); | 419 Filesystem::set_default_filesystem(old_fs_); |
420 } | 420 } |
421 private: | 421 private: |
422 FilesystemInterface* old_fs_; | 422 FilesystemInterface* old_fs_; |
423 DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); | 423 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); |
424 }; | 424 }; |
425 | 425 |
426 // Generates a unique filename based on the input path. If no path component | 426 // Generates a unique filename based on the input path. If no path component |
427 // is specified, it uses the temporary directory. If a filename is provided, | 427 // is specified, it uses the temporary directory. If a filename is provided, |
428 // up to 100 variations of form basename-N.extension are tried. When | 428 // up to 100 variations of form basename-N.extension are tried. When |
429 // create_empty is true, an empty file of this name is created (which | 429 // create_empty is true, an empty file of this name is created (which |
430 // decreases the chance of a temporary filename collision with another | 430 // decreases the chance of a temporary filename collision with another |
431 // process). | 431 // process). |
432 bool CreateUniqueFile(Pathname& path, bool create_empty); | 432 bool CreateUniqueFile(Pathname& path, bool create_empty); |
433 | 433 |
434 } // namespace rtc | 434 } // namespace rtc |
435 | 435 |
436 #endif // WEBRTC_BASE_FILEUTILS_H_ | 436 #endif // WEBRTC_BASE_FILEUTILS_H_ |
OLD | NEW |