Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 round_statistics_.is_initialized = true; | 189 round_statistics_.is_initialized = true; |
| 190 } | 190 } |
| 191 round_statistics_.usage_on_end_of_round = usage; | 191 round_statistics_.usage_on_end_of_round = usage; |
| 192 | 192 |
| 193 int64 amount_to_evict = std::max(usage_overage, diskspace_shortage); | 193 int64 amount_to_evict = std::max(usage_overage, diskspace_shortage); |
| 194 if (status == kQuotaStatusOk && amount_to_evict > 0) { | 194 if (status == kQuotaStatusOk && amount_to_evict > 0) { |
| 195 // Space is getting tight. Get the least recently used origin and continue. | 195 // Space is getting tight. Get the least recently used origin and continue. |
| 196 // TODO(michaeln): if the reason for eviction is low physical disk space, | 196 // TODO(michaeln): if the reason for eviction is low physical disk space, |
| 197 // make 'unlimited' origins subject to eviction too. | 197 // make 'unlimited' origins subject to eviction too. |
| 198 quota_eviction_handler_->GetEvictionOrigin( | 198 quota_eviction_handler_->GetEvictionOrigin( |
| 199 kStorageTypeTemporary, | 199 kStorageTypeTemporary, qau.quota, |
|
michaeln
2015/10/13 20:13:39
funny variable name :)
calamity
2015/10/14 04:49:15
Yeah, should at least be uaq, right?
| |
| 200 base::Bind(&QuotaTemporaryStorageEvictor::OnGotEvictionOrigin, | 200 base::Bind(&QuotaTemporaryStorageEvictor::OnGotEvictionOrigin, |
| 201 weak_factory_.GetWeakPtr())); | 201 weak_factory_.GetWeakPtr())); |
| 202 } else { | 202 } else { |
| 203 if (repeated_eviction_) { | 203 if (repeated_eviction_) { |
| 204 // No action required, sleep for a while and check again later. | 204 // No action required, sleep for a while and check again later. |
| 205 if (statistics_.num_errors_on_getting_usage_and_quota < | 205 if (statistics_.num_errors_on_getting_usage_and_quota < |
| 206 kThresholdOfErrorsToStopEviction) { | 206 kThresholdOfErrorsToStopEviction) { |
| 207 StartEvictionTimerWithDelay(interval_ms_); | 207 StartEvictionTimerWithDelay(interval_ms_); |
| 208 } else { | 208 } else { |
| 209 // TODO(dmikurube): Try restarting eviction after a while. | 209 // TODO(dmikurube): Try restarting eviction after a while. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 ++statistics_.num_errors_on_evicting_origin; | 252 ++statistics_.num_errors_on_evicting_origin; |
| 253 if (repeated_eviction_) { | 253 if (repeated_eviction_) { |
| 254 // Sleep for a while and retry again until we see too many errors. | 254 // Sleep for a while and retry again until we see too many errors. |
| 255 StartEvictionTimerWithDelay(interval_ms_); | 255 StartEvictionTimerWithDelay(interval_ms_); |
| 256 } | 256 } |
| 257 OnEvictionRoundFinished(); | 257 OnEvictionRoundFinished(); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace storage | 261 } // namespace storage |
| OLD | NEW |