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

Unified Diff: content/browser/dom_storage/dom_storage_area.cc

Issue 1953703004: Purge browser cache for dom storage in a smarter way (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dom_storage
Patch Set: Purge all namespaces and use total cache size. Created 4 years, 7 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: content/browser/dom_storage/dom_storage_area.cc
diff --git a/content/browser/dom_storage/dom_storage_area.cc b/content/browser/dom_storage/dom_storage_area.cc
index 26e984b0b2b19ebe9a15cd2190b5a5bad3b282be..2e47cb2e3300b08c12d5e030eb48222bc55d1b14 100644
--- a/content/browser/dom_storage/dom_storage_area.cc
+++ b/content/browser/dom_storage/dom_storage_area.cc
@@ -371,6 +371,7 @@ void DOMStorageArea::InitialImportIfNeeded() {
base::TimeTicks before = base::TimeTicks::Now();
DOMStorageValuesMap initial_values;
backing_->ReadAllValues(&initial_values);
+ backing_->TrimMemory();
map_->SwapValues(&initial_values);
is_initial_import_done_ = true;
base::TimeDelta time_to_import = base::TimeTicks::Now() - before;
@@ -476,6 +477,8 @@ void DOMStorageArea::CommitChanges(const CommitBatch* commit_batch) {
DCHECK(task_runner_->IsRunningOnCommitSequence());
backing_->CommitChanges(commit_batch->clear_all_first,
commit_batch->changed_values);
+ backing_->TrimMemory();
michaeln 2016/05/14 00:42:52 What i meant by not exposing this in public api wa
ssid 2016/05/16 20:51:56 Sorry, I was blind. Fixed this.
+
// TODO(michaeln): what if CommitChanges returns false (e.g., we're trying to
// commit to a DB which is in an inconsistent state?)
task_runner_->PostTask(
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.h ('k') | content/browser/dom_storage/dom_storage_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698