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..dc78409894c745ad3ba92c7d15074cefcc74b379 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 |
|
danakj
2016/11/28 22:55:56
This comment is no less true now is it? So IOAllow
fdoray
2016/11/29 15:41:20
I decided to reset ThreadRestrictions in RunTask()
|
| - // 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()); |
|
danakj
2016/11/28 22:55:56
Is reading and writing thread-local storage before
fdoray
2016/11/29 15:41:20
I don't think we need to optimize this since Threa
danakj
2016/12/01 21:59:04
The assert methods are no-ops. The setters are not
fdoray
2016/12/01 22:30:43
Yes they are. The whole implementation file is gua
|
| { |
| // 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::SetIOAllowed(previous_io_allowed); |
| + ThreadRestrictions::SetSingletonAllowed(previous_singleton_allowed); |
| + |
| AfterRunTask(shutdown_behavior); |
| } |