Chromium Code Reviews| Index: base/task_scheduler/task_tracker.cc |
| diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc |
| index d06a84dc1f47dd7a4cb16f4463a4fa0c486a6dca..49a33be8c24b113f82c0ab0a1ad1047465aee2bb 100644 |
| --- a/base/task_scheduler/task_tracker.cc |
| +++ b/base/task_scheduler/task_tracker.cc |
| @@ -219,12 +219,12 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task, |
| const bool is_delayed = !task->delayed_run_time.is_null(); |
| if (can_run_task) { |
| - // All tasks run through here and the scheduler itself doesn't use |
| - // singletons. Therefore, it isn't necessary to reset the singleton allowed |
| - // bit after running the task. |
| - ThreadRestrictions::SetSingletonAllowed( |
| - task->traits.shutdown_behavior() != |
| - TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN); |
| + const bool previous_singleton_allowed = |
| + ThreadRestrictions::SetSingletonAllowed( |
| + task->traits.shutdown_behavior() != |
| + TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN); |
| + const bool previous_io_allowed = |
| + ThreadRestrictions::SetIOAllowed(task->traits.with_file_io()); |
| { |
| // Set up SequenceToken as expected for the scope of the task. |
| @@ -261,6 +261,9 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task, |
| PerformRunTask(std::move(task)); |
| } |
| + ThreadRestrictions::SetSingletonAllowed(previous_singleton_allowed); |
|
robliao
2016/11/28 22:17:41
I presume this will change with the other CL that
fdoray
2016/11/28 22:36:15
Done. Reordered in this CL.
|
| + ThreadRestrictions::SetIOAllowed(previous_io_allowed); |
| + |
| AfterRunTask(shutdown_behavior); |
| } |