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

Side by Side Diff: webkit/quota/quota_temporary_storage_evictor.cc

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/quota/quota_temporary_storage_evictor.h" 5 #include "webkit/quota/quota_temporary_storage_evictor.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "webkit/quota/quota_manager.h" 9 #include "webkit/quota/quota_manager.h"
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 round_statistics_ = EvictionRoundStatistics(); 122 round_statistics_ = EvictionRoundStatistics();
123 } 123 }
124 124
125 void QuotaTemporaryStorageEvictor::Start() { 125 void QuotaTemporaryStorageEvictor::Start() {
126 DCHECK(CalledOnValidThread()); 126 DCHECK(CalledOnValidThread());
127 StartEvictionTimerWithDelay(0); 127 StartEvictionTimerWithDelay(0);
128 128
129 if (histogram_timer_.IsRunning()) 129 if (histogram_timer_.IsRunning())
130 return; 130 return;
131 histogram_timer_.Start(kHistogramReportInterval, this, 131 histogram_timer_.Start(kHistogramReportInterval, this,
132 &QuotaTemporaryStorageEvictor::ReportPerHourHistogram); 132 &QuotaTemporaryStorageEvictor::ReportPerHourHistogram,
133 FROM_HERE);
133 } 134 }
134 135
135 void QuotaTemporaryStorageEvictor::StartEvictionTimerWithDelay(int delay_ms) { 136 void QuotaTemporaryStorageEvictor::StartEvictionTimerWithDelay(int delay_ms) {
136 if (eviction_timer_.IsRunning()) 137 if (eviction_timer_.IsRunning())
137 return; 138 return;
138 eviction_timer_.Start(base::TimeDelta::FromMilliseconds(delay_ms), this, 139 eviction_timer_.Start(base::TimeDelta::FromMilliseconds(delay_ms), this,
139 &QuotaTemporaryStorageEvictor::ConsiderEviction); 140 &QuotaTemporaryStorageEvictor::ConsiderEviction,
141 FROM_HERE);
140 } 142 }
141 143
142 void QuotaTemporaryStorageEvictor::ConsiderEviction() { 144 void QuotaTemporaryStorageEvictor::ConsiderEviction() {
143 OnEvictionRoundStarted(); 145 OnEvictionRoundStarted();
144 146
145 // Get usage and disk space, then continue. 147 // Get usage and disk space, then continue.
146 quota_eviction_handler_->GetUsageAndQuotaForEviction(callback_factory_. 148 quota_eviction_handler_->GetUsageAndQuotaForEviction(callback_factory_.
147 NewCallback( 149 NewCallback(
148 &QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction)); 150 &QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction));
149 } 151 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ++statistics_.num_errors_on_evicting_origin; 240 ++statistics_.num_errors_on_evicting_origin;
239 if (repeated_eviction_) { 241 if (repeated_eviction_) {
240 // Sleep for a while and retry again until we see too many errors. 242 // Sleep for a while and retry again until we see too many errors.
241 StartEvictionTimerWithDelay(interval_ms_); 243 StartEvictionTimerWithDelay(interval_ms_);
242 } 244 }
243 OnEvictionRoundFinished(); 245 OnEvictionRoundFinished();
244 } 246 }
245 } 247 }
246 248
247 } // namespace quota 249 } // namespace quota
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698