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

Unified Diff: chrome/browser/sync/profile_sync_service_harness.cc

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename back to "allow". Created 8 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 | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/ui/views/simple_message_box_views.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_harness.cc
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 34b6124c510140ac1f4de1c4be07818fbdd28bad..13fcc71d7f1b43de5f1aa8294cb4790c88681f51 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -746,16 +746,17 @@ bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout(
}
scoped_refptr<StateChangeTimeoutEvent> timeout_signal(
new StateChangeTimeoutEvent(this, reason));
- MessageLoop* loop = MessageLoop::current();
- bool did_allow_nestable_tasks = loop->NestableTasksAllowed();
- loop->SetNestableTasksAllowed(true);
- loop->PostDelayedTask(
- FROM_HERE,
- base::Bind(&StateChangeTimeoutEvent::Callback,
- timeout_signal.get()),
- base::TimeDelta::FromMilliseconds(timeout_milliseconds));
- loop->Run();
- loop->SetNestableTasksAllowed(did_allow_nestable_tasks);
+ {
+ MessageLoop* loop = MessageLoop::current();
+ MessageLoop::ScopedNestableTaskAllower allow(loop);
+ loop->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&StateChangeTimeoutEvent::Callback,
+ timeout_signal.get()),
+ base::TimeDelta::FromMilliseconds(timeout_milliseconds));
+ loop->Run();
+ }
+
if (timeout_signal->Abort()) {
DVLOG(1) << GetClientInfoString("AwaitStatusChangeWithTimeout succeeded");
return true;
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/ui/views/simple_message_box_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698