| 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_system.h" | 5 #include "components/drive/chromeos/file_system.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 const GetFilePathCallback& callback, | 203 const GetFilePathCallback& callback, |
| 204 FileError error) { | 204 FileError error) { |
| 205 callback.Run(error, *file_path); | 205 callback.Run(error, *file_path); |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool FreeDiskSpaceIfNeededForOnBlockingPool(internal::FileCache* cache, | 208 bool FreeDiskSpaceIfNeededForOnBlockingPool(internal::FileCache* cache, |
| 209 int64_t num_bytes) { | 209 int64_t num_bytes) { |
| 210 return cache->FreeDiskSpaceIfNeededFor(num_bytes); | 210 return cache->FreeDiskSpaceIfNeededFor(num_bytes); |
| 211 } | 211 } |
| 212 | 212 |
| 213 uint64_t CalculateEvictableCacheSizeOnBlockingPool(internal::FileCache* cache) { | 213 int64_t CalculateCacheSizeOnBlockingPool(internal::FileCache* cache) { |
| 214 return cache->CalculateCacheSize(); |
| 215 } |
| 216 |
| 217 int64_t CalculateEvictableCacheSizeOnBlockingPool(internal::FileCache* cache) { |
| 214 return cache->CalculateEvictableCacheSize(); | 218 return cache->CalculateEvictableCacheSize(); |
| 215 } | 219 } |
| 216 | 220 |
| 217 // Excludes hosted documents from the given entries. | 221 // Excludes hosted documents from the given entries. |
| 218 // Used to implement ReadDirectory(). | 222 // Used to implement ReadDirectory(). |
| 219 void FilterHostedDocuments(const ReadDirectoryEntriesCallback& callback, | 223 void FilterHostedDocuments(const ReadDirectoryEntriesCallback& callback, |
| 220 std::unique_ptr<ResourceEntryVector> entries) { | 224 std::unique_ptr<ResourceEntryVector> entries) { |
| 221 DCHECK(!callback.is_null()); | 225 DCHECK(!callback.is_null()); |
| 222 | 226 |
| 223 if (entries) { | 227 if (entries) { |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 int64_t num_bytes, | 1048 int64_t num_bytes, |
| 1045 const FreeDiskSpaceCallback& callback) { | 1049 const FreeDiskSpaceCallback& callback) { |
| 1046 DCHECK(thread_checker_.CalledOnValidThread()); | 1050 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1047 DCHECK(!callback.is_null()); | 1051 DCHECK(!callback.is_null()); |
| 1048 base::PostTaskAndReplyWithResult( | 1052 base::PostTaskAndReplyWithResult( |
| 1049 blocking_task_runner_.get(), FROM_HERE, | 1053 blocking_task_runner_.get(), FROM_HERE, |
| 1050 base::Bind(&FreeDiskSpaceIfNeededForOnBlockingPool, cache_, num_bytes), | 1054 base::Bind(&FreeDiskSpaceIfNeededForOnBlockingPool, cache_, num_bytes), |
| 1051 callback); | 1055 callback); |
| 1052 } | 1056 } |
| 1053 | 1057 |
| 1054 void FileSystem::CalculateEvictableCacheSize( | 1058 void FileSystem::CalculateCacheSize(const CacheSizeCallback& callback) { |
| 1055 const EvictableCacheSizeCallback& callback) { | |
| 1056 DCHECK(thread_checker_.CalledOnValidThread()); | 1059 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1057 DCHECK(!callback.is_null()); | 1060 DCHECK(!callback.is_null()); |
| 1058 base::PostTaskAndReplyWithResult( | 1061 base::PostTaskAndReplyWithResult( |
| 1062 blocking_task_runner_.get(), FROM_HERE, |
| 1063 base::Bind(&CalculateCacheSizeOnBlockingPool, cache_), callback); |
| 1064 } |
| 1065 |
| 1066 void FileSystem::CalculateEvictableCacheSize( |
| 1067 const CacheSizeCallback& callback) { |
| 1068 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1069 DCHECK(!callback.is_null()); |
| 1070 base::PostTaskAndReplyWithResult( |
| 1059 blocking_task_runner_.get(), FROM_HERE, | 1071 blocking_task_runner_.get(), FROM_HERE, |
| 1060 base::Bind(&CalculateEvictableCacheSizeOnBlockingPool, cache_), callback); | 1072 base::Bind(&CalculateEvictableCacheSizeOnBlockingPool, cache_), callback); |
| 1061 } | 1073 } |
| 1062 } // namespace drive | 1074 } // namespace drive |
| OLD | NEW |