| 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 #include "components/drive/chromeos/file_cache.h" | 5 #include "components/drive/chromeos/file_cache.h" |
| 6 | 6 |
| 7 #include <linux/fs.h> | 7 #include <linux/fs.h> |
| 8 #include <sys/ioctl.h> | 8 #include <sys/ioctl.h> |
| 9 #include <sys/xattr.h> | 9 #include <sys/xattr.h> |
| 10 | 10 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 void FileCache::SetMaxNumOfEvictedCacheFilesForTest( | 187 void FileCache::SetMaxNumOfEvictedCacheFilesForTest( |
| 188 size_t max_num_of_evicted_cache_files) { | 188 size_t max_num_of_evicted_cache_files) { |
| 189 max_num_of_evicted_cache_files_ = max_num_of_evicted_cache_files; | 189 max_num_of_evicted_cache_files_ = max_num_of_evicted_cache_files; |
| 190 } | 190 } |
| 191 | 191 |
| 192 base::FilePath FileCache::GetCacheFilePath(const std::string& id) const { | 192 base::FilePath FileCache::GetCacheFilePath(const std::string& id) const { |
| 193 return GetPathForId(cache_file_directory_, id); | 193 return GetPathForId(cache_file_directory_, id); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void FileCache::AssertOnSequencedWorkerPool() { | 196 void FileCache::AssertOnSequencedWorkerPool() { |
| 197 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); | 197 DCHECK(blocking_task_runner_->RunsTasksInCurrentSequence()); |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool FileCache::IsUnderFileCacheDirectory(const base::FilePath& path) const { | 200 bool FileCache::IsUnderFileCacheDirectory(const base::FilePath& path) const { |
| 201 return cache_file_directory_.IsParent(path); | 201 return cache_file_directory_.IsParent(path); |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool FileCache::FreeDiskSpaceIfNeededFor(int64_t num_bytes) { | 204 bool FileCache::FreeDiskSpaceIfNeededFor(int64_t num_bytes) { |
| 205 AssertOnSequencedWorkerPool(); | 205 AssertOnSequencedWorkerPool(); |
| 206 | 206 |
| 207 // Do nothing and return if we have enough space. | 207 // Do nothing and return if we have enough space. |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 | 932 |
| 933 bool FileCache::IsEvictable(const std::string& id, const ResourceEntry& entry) { | 933 bool FileCache::IsEvictable(const std::string& id, const ResourceEntry& entry) { |
| 934 return IsPresent(entry) && | 934 return IsPresent(entry) && |
| 935 !entry.file_specific_info().cache_state().is_pinned() && | 935 !entry.file_specific_info().cache_state().is_pinned() && |
| 936 !entry.file_specific_info().cache_state().is_dirty() && | 936 !entry.file_specific_info().cache_state().is_dirty() && |
| 937 !mounted_files_.count(id); | 937 !mounted_files_.count(id); |
| 938 } | 938 } |
| 939 | 939 |
| 940 } // namespace internal | 940 } // namespace internal |
| 941 } // namespace drive | 941 } // namespace drive |
| OLD | NEW |