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

Unified Diff: content/renderer/dom_storage/local_storage_cached_area.cc

Issue 2649963002: Enable mojo localstorage to actually store on disk. (Closed)
Patch Set: add uma 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: content/renderer/dom_storage/local_storage_cached_area.cc
diff --git a/content/renderer/dom_storage/local_storage_cached_area.cc b/content/renderer/dom_storage/local_storage_cached_area.cc
index a7ba25ed57f06cf00d6ece81ee364c866c84134d..7721c79ac6fcd196a0920f51f2ff21e9094adec7 100644
--- a/content/renderer/dom_storage/local_storage_cached_area.cc
+++ b/content/renderer/dom_storage/local_storage_cached_area.cc
@@ -150,7 +150,15 @@ void LocalStorageCachedArea::RemoveItem(const base::string16& key,
void LocalStorageCachedArea::Clear(const GURL& page_url,
const std::string& storage_area_id) {
- // No need to prime the cache in this case.
+ // No need to prime the cache in this case. We still need to make sure the
+ // LevelDBWrapper is actually ready and connected to a database to ensure
+ // changes will get written to the database if the browser quits soon.
+ if (!map_) {
+ base::TimeTicks before = base::TimeTicks::Now();
+ leveldb_->Sync();
michaeln 2017/01/25 02:28:38 that's unfortunate? would an async call to storag
Marijn Kruisselbrink 2017/01/25 22:00:07 Yes, it is. I don't really see a way around it tho
michaeln 2017/01/25 23:53:28 I see, the problem is not the renderer-to-browser
+ base::TimeDelta time_to_prime = base::TimeTicks::Now() - before;
+ UMA_HISTOGRAM_TIMES("LocalStorage.MojoTimeToPrimeClear", time_to_prime);
+ }
Reset();
map_ = new DOMStorageMap(kPerStorageAreaQuota);

Powered by Google App Engine
This is Rietveld 408576698