Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: storage/browser/quota/quota_temporary_storage_evictor.cc

Issue 1343273003: Integrate SiteEngagementEvictionPolicy with QuotaManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_eviction_policy
Patch Set: address comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « storage/browser/quota/quota_manager.cc ('k') | storage/browser/quota/usage_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
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
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
OLDNEW
« no previous file with comments | « storage/browser/quota/quota_manager.cc ('k') | storage/browser/quota/usage_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698