Chromium Code Reviews| 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. |