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

Unified Diff: components/browsing_data/content/conditional_cache_counting_helper.cc

Issue 2626223002: Show the exact cache size for time ranges if supported (Closed)
Patch Set: fix chromeos build Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/browsing_data/content/conditional_cache_counting_helper.cc
diff --git a/components/browsing_data/content/conditional_cache_counting_helper.cc b/components/browsing_data/content/conditional_cache_counting_helper.cc
index 94b772f14c77872889bde3042fc4ed67035ae367..05f4f17d49349d700572e85499180940870b1c3c 100644
--- a/components/browsing_data/content/conditional_cache_counting_helper.cc
+++ b/components/browsing_data/content/conditional_cache_counting_helper.cc
@@ -57,6 +57,7 @@ ConditionalCacheCountingHelper::CountAndDestroySelfWhenFinished(
DCHECK(!result_callback.is_null());
result_callback_ = result_callback;
calculation_result_ = 0;
+ is_upper_limit_ = false;
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -73,7 +74,7 @@ void ConditionalCacheCountingHelper::Finished() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!is_finished_);
is_finished_ = true;
- result_callback_.Run(calculation_result_);
+ result_callback_.Run(calculation_result_, is_upper_limit_);
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
}
@@ -141,11 +142,16 @@ void ConditionalCacheCountingHelper::DoCountCache(int rv) {
base::Bind(&ConditionalCacheCountingHelper::DoCountCache,
base::Unretained(this)));
} else {
- // TODO(dullweber): Readd code for counting with timeout.
- // TODO(dullweber): Implement faster counting for SimpleBackendImpl.
- rv = cache_->CalculateSizeOfAllEntries(
+ rv = cache_->CalculateSizeOfEntriesBetween(
msramek 2017/01/12 14:44:07 This is based on top of 2626173003, right? Please
dullweber 2017/01/12 15:03:42 Done.
+ begin_time_, end_time_,
base::Bind(&ConditionalCacheCountingHelper::DoCountCache,
base::Unretained(this)));
+ if (rv == net::ERR_NOT_IMPLEMENTED) {
+ is_upper_limit_ = true;
+ rv = cache_->CalculateSizeOfAllEntries(
+ base::Bind(&ConditionalCacheCountingHelper::DoCountCache,
+ base::Unretained(this)));
+ }
}
cache_ = NULL;
}

Powered by Google App Engine
This is Rietveld 408576698