summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/profile_sync_service_harness.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/profile_sync_service_harness.cc')
-rw-r--r--chrome/browser/sync/profile_sync_service_harness.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 34b6124..13fcc71 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;