| 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 "webkit/browser/quota/quota_temporary_storage_evictor.h" | 5 #include "webkit/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 11 matching lines...) Expand all Loading... |
| 22 base::TimeDelta::FromMinutes(1), \ | 22 base::TimeDelta::FromMinutes(1), \ |
| 23 base::TimeDelta::FromDays(1), 50) | 23 base::TimeDelta::FromDays(1), 50) |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 const int64 kMBytes = 1024 * 1024; | 26 const int64 kMBytes = 1024 * 1024; |
| 27 const double kUsageRatioToStartEviction = 0.7; | 27 const double kUsageRatioToStartEviction = 0.7; |
| 28 const int kThresholdOfErrorsToStopEviction = 5; | 28 const int kThresholdOfErrorsToStopEviction = 5; |
| 29 const int kHistogramReportIntervalMinutes = 60; | 29 const int kHistogramReportIntervalMinutes = 60; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace quota { | 32 namespace storage { |
| 33 | 33 |
| 34 const int QuotaTemporaryStorageEvictor:: | 34 const int QuotaTemporaryStorageEvictor:: |
| 35 kMinAvailableDiskSpaceToStartEvictionNotSpecified = -1; | 35 kMinAvailableDiskSpaceToStartEvictionNotSpecified = -1; |
| 36 | 36 |
| 37 QuotaTemporaryStorageEvictor::EvictionRoundStatistics::EvictionRoundStatistics() | 37 QuotaTemporaryStorageEvictor::EvictionRoundStatistics::EvictionRoundStatistics() |
| 38 : in_round(false), | 38 : in_round(false), |
| 39 is_initialized(false), | 39 is_initialized(false), |
| 40 usage_overage_at_round(-1), | 40 usage_overage_at_round(-1), |
| 41 diskspace_shortage_at_round(-1), | 41 diskspace_shortage_at_round(-1), |
| 42 usage_on_beginning_of_round(-1), | 42 usage_on_beginning_of_round(-1), |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } else { | 251 } else { |
| 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 quota | 261 } // namespace storage |
| OLD | NEW |