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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
190 void QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction( | 190 void QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction( |
191 int64_t must_remain_available_space, | 191 int64_t must_remain_available_space, |
192 QuotaStatusCode status, | 192 QuotaStatusCode status, |
193 const UsageAndQuota& qau) { | 193 const XUsageAndQuota& qau) { |
194 DCHECK(CalledOnValidThread()); | 194 DCHECK(CalledOnValidThread()); |
195 | 195 |
196 int64_t usage = qau.global_limited_usage; | 196 int64_t usage = qau.global_limited_usage; |
197 DCHECK_GE(usage, 0); | 197 DCHECK_GE(usage, 0); |
198 | 198 |
199 if (status != kQuotaStatusOk) | 199 if (status != kQuotaStatusOk) |
200 ++statistics_.num_errors_on_getting_usage_and_quota; | 200 ++statistics_.num_errors_on_getting_usage_and_quota; |
201 | 201 |
202 int64_t usage_overage = std::max( | 202 int64_t usage_overage = std::max( |
203 static_cast<int64_t>(0), | 203 static_cast<int64_t>(0), |
(...skipping 82 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 |