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

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

Issue 1129233003: localStorage: Aggressively flush to disk for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-storage-flush-android
Patch Set: Added trace event. Created 5 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
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56a1fd008a65538bc45e707c59f530d66ab24837..67c7b98ac1ad2daa431256da55079eadbd02a822 100644
--- a/content/browser/dom_storage/dom_storage_area.cc
+++ b/content/browser/dom_storage/dom_storage_area.cc
@@ -42,6 +42,8 @@ const int kMaxCommitsPerHour = 6;
} // namespace
+bool DOMStorageArea::s_aggressive_flushing_enabled_ = false;
+
DOMStorageArea::RateLimiter::RateLimiter(size_t desired_rate,
base::TimeDelta time_quantum)
: rate_(desired_rate), samples_(0), time_quantum_(time_quantum) {
@@ -90,6 +92,10 @@ GURL DOMStorageArea::OriginFromDatabaseFileName(const base::FilePath& name) {
return storage::GetOriginFromIdentifier(origin_id);
}
+void DOMStorageArea::EnableAggressiveCommitDelay() {
+ s_aggressive_flushing_enabled_ = true;
+}
+
DOMStorageArea::DOMStorageArea(const GURL& origin,
const base::FilePath& directory,
DOMStorageTaskRunner* task_runner)
@@ -388,6 +394,9 @@ void DOMStorageArea::StartCommitTimer() {
}
base::TimeDelta DOMStorageArea::ComputeCommitDelay() const {
+ if (s_aggressive_flushing_enabled_)
+ return base::TimeDelta::FromSeconds(1);
+
base::TimeDelta elapsed_time = base::TimeTicks::Now() - start_time_;
base::TimeDelta delay = std::max(
base::TimeDelta::FromSeconds(kCommitDefaultDelaySecs),
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698