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

Unified Diff: chrome/browser/browser_process_impl.cc

Issue 1140013003: Adjust LocalStorage commit rate limiting. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | content/browser/dom_storage/dom_storage_namespace.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_process_impl.cc
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 863c96a8c4e25b5ebef6c627001b884590d47815..1d78cddde38a7e3678574ab4eb9b593a09620a51 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -412,6 +412,8 @@ class RundownTaskCounter :
// Posts a rundown task to |task_runner|, can be invoked an arbitrary number
// of times before calling TimedWait.
void Post(base::SequencedTaskRunner* task_runner);
+ void PostMany(
+ const std::vector<scoped_refptr<base::SequencedTaskRunner>> &runners);
// Waits until the count is zero or |max_time| has passed.
// This can only be called once per instance.
@@ -437,6 +439,12 @@ RundownTaskCounter::RundownTaskCounter()
: count_(1), waitable_event_(true, false) {
}
+void RundownTaskCounter::PostMany(
+ const std::vector<scoped_refptr<base::SequencedTaskRunner>> &runners) {
+ for (const auto& runner : runners)
+ Post(runner.get());
+}
+
void RundownTaskCounter::Post(base::SequencedTaskRunner* task_runner) {
// As the count starts off at one, it should never get to zero unless
// TimedWait has been called.
@@ -462,6 +470,13 @@ bool RundownTaskCounter::TimedWait(const base::TimeDelta& max_time) {
return waitable_event_.TimedWait(max_time);
}
+void FlushStoragePartition(
+ RundownTaskCounter* rundown_counter,
+ content::StoragePartition* partition) {
+ partition->Flush();
+ //rundown_counter->PostMany(partition->GetFlushTaskRunners());
+}
+
} // namespace
void BrowserProcessImpl::EndSession() {
@@ -476,6 +491,8 @@ void BrowserProcessImpl::EndSession() {
profile->GetPrefs()->CommitPendingWrite();
rundown_counter->Post(profile->GetIOTaskRunner().get());
}
+ content::BrowserContext::ForEachStoragePartition(
+ profile, base::Bind(FlushStoragePartition, rundown_counter));
hashimoto 2015/05/14 04:46:09 I'm not sure if this will work as expected. Curren
}
// Tell the metrics service it was cleanly shutdown.
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_namespace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698