Chromium Code Reviews| 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 |
| 11 #ifndef WEBRTC_BASE_FILEUTILS_H_ | 11 #ifndef WEBRTC_BASE_FILEUTILS_H_ |
| 12 #define WEBRTC_BASE_FILEUTILS_H_ | 12 #define WEBRTC_BASE_FILEUTILS_H_ |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #if !defined(WEBRTC_WIN) | 16 #if !defined(WEBRTC_WIN) |
| 17 #include <dirent.h> | 17 #include <dirent.h> |
| 18 #include <stdio.h> | 18 #include <stdio.h> |
| 19 #include <sys/stat.h> | 19 #include <sys/stat.h> |
| 20 #include <sys/types.h> | 20 #include <sys/types.h> |
| 21 #include <unistd.h> | 21 #include <unistd.h> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #include "webrtc/base/basictypes.h" | 24 #include "webrtc/base/checks.h" |
| 25 #include "webrtc/base/common.h" | |
| 26 #include "webrtc/base/constructormagic.h" | 25 #include "webrtc/base/constructormagic.h" |
| 27 #include "webrtc/base/platform_file.h" | 26 #include "webrtc/base/platform_file.h" |
| 28 | 27 |
| 29 namespace rtc { | 28 namespace rtc { |
| 30 | 29 |
| 31 class FileStream; | 30 class FileStream; |
| 32 class Pathname; | 31 class Pathname; |
| 33 | 32 |
| 34 ////////////////////////// | 33 ////////////////////////// |
| 35 // Directory Iterator // | 34 // Directory Iterator // |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 virtual bool GetAppTempFolder(Pathname* path) = 0; | 167 virtual bool GetAppTempFolder(Pathname* path) = 0; |
| 169 | 168 |
| 170 virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) = 0; | 169 virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) = 0; |
| 171 | 170 |
| 172 // Note: These might go into some shared config section later, but they're | 171 // Note: These might go into some shared config section later, but they're |
| 173 // used by some methods in this interface, so we're leaving them here for now. | 172 // used by some methods in this interface, so we're leaving them here for now. |
| 174 void SetOrganizationName(const std::string& organization) { | 173 void SetOrganizationName(const std::string& organization) { |
| 175 organization_name_ = organization; | 174 organization_name_ = organization; |
| 176 } | 175 } |
| 177 void GetOrganizationName(std::string* organization) { | 176 void GetOrganizationName(std::string* organization) { |
| 178 ASSERT(NULL != organization); | 177 RTC_DCHECK(NULL != organization); |
|
stefan-webrtc
2016/12/06 10:12:36
organization != nullptr
similar below
Hzj_jie
2016/12/06 22:33:07
Done.
| |
| 179 *organization = organization_name_; | 178 *organization = organization_name_; |
| 180 } | 179 } |
| 181 void SetApplicationName(const std::string& application) { | 180 void SetApplicationName(const std::string& application) { |
| 182 application_name_ = application; | 181 application_name_ = application; |
| 183 } | 182 } |
| 184 void GetApplicationName(std::string* application) { | 183 void GetApplicationName(std::string* application) { |
| 185 ASSERT(NULL != application); | 184 RTC_DCHECK(NULL != application); |
| 186 *application = application_name_; | 185 *application = application_name_; |
| 187 } | 186 } |
| 188 | 187 |
| 189 protected: | 188 protected: |
| 190 std::string organization_name_; | 189 std::string organization_name_; |
| 191 std::string application_name_; | 190 std::string application_name_; |
| 192 }; | 191 }; |
| 193 | 192 |
| 194 class Filesystem { | 193 class Filesystem { |
| 195 public: | 194 public: |
| 196 static FilesystemInterface *default_filesystem() { | 195 static FilesystemInterface *default_filesystem() { |
| 197 ASSERT(default_filesystem_ != NULL); | 196 RTC_DCHECK(default_filesystem_ != NULL); |
| 198 return default_filesystem_; | 197 return default_filesystem_; |
| 199 } | 198 } |
| 200 | 199 |
| 201 static void set_default_filesystem(FilesystemInterface *filesystem) { | 200 static void set_default_filesystem(FilesystemInterface *filesystem) { |
| 202 default_filesystem_ = filesystem; | 201 default_filesystem_ = filesystem; |
| 203 } | 202 } |
| 204 | 203 |
| 205 static FilesystemInterface *swap_default_filesystem( | 204 static FilesystemInterface *swap_default_filesystem( |
| 206 FilesystemInterface *filesystem) { | 205 FilesystemInterface *filesystem) { |
| 207 FilesystemInterface *cur = default_filesystem_; | 206 FilesystemInterface *cur = default_filesystem_; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 Filesystem::set_default_filesystem(old_fs_); | 320 Filesystem::set_default_filesystem(old_fs_); |
| 322 } | 321 } |
| 323 private: | 322 private: |
| 324 FilesystemInterface* old_fs_; | 323 FilesystemInterface* old_fs_; |
| 325 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); | 324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FilesystemScope); |
| 326 }; | 325 }; |
| 327 | 326 |
| 328 } // namespace rtc | 327 } // namespace rtc |
| 329 | 328 |
| 330 #endif // WEBRTC_BASE_FILEUTILS_H_ | 329 #endif // WEBRTC_BASE_FILEUTILS_H_ |
| OLD | NEW |