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

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: rebase 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
« no previous file with comments | « components/browsing_data/content/conditional_cache_counting_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
+ 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;
}
« no previous file with comments | « components/browsing_data/content/conditional_cache_counting_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698