OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "storage/browser/quota/quota_temporary_storage_evictor.h" | 5 #include "storage/browser/quota/quota_temporary_storage_evictor.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 weak_factory_.GetWeakPtr())); | 169 weak_factory_.GetWeakPtr())); |
170 } else { | 170 } else { |
171 quota_eviction_handler_->GetUsageAndQuotaForEviction( | 171 quota_eviction_handler_->GetUsageAndQuotaForEviction( |
172 base::Bind(&QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction, | 172 base::Bind(&QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction, |
173 weak_factory_.GetWeakPtr(), | 173 weak_factory_.GetWeakPtr(), |
174 min_available_to_start_eviction_)); | 174 min_available_to_start_eviction_)); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void QuotaTemporaryStorageEvictor::OnGotVolumeInfo( | 178 void QuotaTemporaryStorageEvictor::OnGotVolumeInfo( |
179 bool success, uint64_t available_space, uint64_t total_size) { | 179 bool success, int64_t available_space, int64_t total_size) { |
180 // Compute how much to keep free as a function of total disk size. | 180 // Compute how much to keep free as a function of total disk size. |
181 int64_t must_remain_available_space = success ? | 181 int64_t must_remain_available_space = success ? |
182 static_cast<int64_t>(total_size * kMustRemainAvailableRatio) : | 182 static_cast<int64_t>(total_size * kMustRemainAvailableRatio) : |
183 kDefaultMustRemainAvailableSpace; | 183 kDefaultMustRemainAvailableSpace; |
184 | 184 |
185 quota_eviction_handler_->GetUsageAndQuotaForEviction( | 185 quota_eviction_handler_->GetUsageAndQuotaForEviction( |
186 base::Bind(&QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction, | 186 base::Bind(&QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction, |
187 weak_factory_.GetWeakPtr(), must_remain_available_space)); | 187 weak_factory_.GetWeakPtr(), must_remain_available_space)); |
188 } | 188 } |
189 | 189 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 ++statistics_.num_errors_on_evicting_origin; | 286 ++statistics_.num_errors_on_evicting_origin; |
287 if (repeated_eviction_) { | 287 if (repeated_eviction_) { |
288 // Sleep for a while and retry again until we see too many errors. | 288 // Sleep for a while and retry again until we see too many errors. |
289 StartEvictionTimerWithDelay(interval_ms_); | 289 StartEvictionTimerWithDelay(interval_ms_); |
290 } | 290 } |
291 OnEvictionRoundFinished(); | 291 OnEvictionRoundFinished(); |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 } // namespace storage | 295 } // namespace storage |
OLD | NEW |