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

Unified Diff: session_manager_service.cc

Issue 6604012: [login_manager] Fix thread-safety issues at shutdown (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: Created 9 years, 10 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 | « session_manager_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: session_manager_service.cc
diff --git a/session_manager_service.cc b/session_manager_service.cc
index d708ef1be3ff5b508b64271db640157f145f61fa..29313f30d354e70b741953a1a721c15d541722c2 100644
--- a/session_manager_service.cc
+++ b/session_manager_service.cc
@@ -328,7 +328,12 @@ bool SessionManagerService::Shutdown() {
}
// Even if we haven't gotten around to processing a persist task.
- store_->Persist();
+ base::WaitableEvent event(true, false);
+ io_thread_.message_loop()->PostTask(
+ FROM_HERE, NewRunnableMethod(this,
+ &SessionManagerService::PersistStoreSync,
+ &event));
+ event.Wait();
io_thread_.Stop();
message_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask());
LOG(INFO) << "SessionManagerService quitting run loop";
@@ -909,6 +914,12 @@ void SessionManagerService::PersistWhitelist() {
what_happened));
}
+void SessionManagerService::PersistStoreSync(base::WaitableEvent* event) {
+ store_->Persist();
+ LOG(INFO) << "Persisted Store to disk.";
+ event->Signal();
+}
+
void SessionManagerService::PersistStore() {
LOG(INFO) << "Persisting Store to disk.";
bool what_happened = store_->Persist();
« no previous file with comments | « session_manager_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698