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

Unified Diff: base/task_scheduler/task_tracker.cc

Issue 2531663003: TaskScheduler: Add TaskTraits::WithWait(). (Closed)
Patch Set: CR gab #3 (enforce AssertWaitAllowed requires WithWait) Created 4 years, 1 month 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
Index: base/task_scheduler/task_tracker.cc
diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc
index 49a33be8c24b113f82c0ab0a1ad1047465aee2bb..5b514a61aa6ba3152ccc9b4b6ea2f438c912a0e6 100644
--- a/base/task_scheduler/task_tracker.cc
+++ b/base/task_scheduler/task_tracker.cc
@@ -225,6 +225,8 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task,
TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN);
const bool previous_io_allowed =
ThreadRestrictions::SetIOAllowed(task->traits.with_file_io());
+ const bool previous_wait_allowed =
+ ThreadRestrictions::SetWaitAllowed(task->traits.with_wait());
{
// Set up SequenceToken as expected for the scope of the task.
@@ -263,6 +265,7 @@ bool TaskTracker::RunTask(std::unique_ptr<Task> task,
ThreadRestrictions::SetSingletonAllowed(previous_singleton_allowed);
ThreadRestrictions::SetIOAllowed(previous_io_allowed);
+ ThreadRestrictions::SetWaitAllowed(previous_wait_allowed);
robliao 2016/11/28 20:09:50 Nit: Order above SetIOAllowed for symmetry. We sho
fdoray 2016/11/28 21:47:51 Done.
AfterRunTask(shutdown_behavior);
}

Powered by Google App Engine
This is Rietveld 408576698