diff options
Diffstat (limited to 'content/browser/dom_storage/dom_storage_area.cc')
-rw-r--r-- | content/browser/dom_storage/dom_storage_area.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/content/browser/dom_storage/dom_storage_area.cc b/content/browser/dom_storage/dom_storage_area.cc index 56a1fd0..67c7b98 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), |