| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/task_scheduler/task_tracker.h" | 5 #include "base/task_scheduler/task_tracker.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const Task* task = sequence->PeekTask(); | 185 const Task* task = sequence->PeekTask(); |
| 186 | 186 |
| 187 const TaskShutdownBehavior shutdown_behavior = | 187 const TaskShutdownBehavior shutdown_behavior = |
| 188 task->traits.shutdown_behavior(); | 188 task->traits.shutdown_behavior(); |
| 189 if (!BeforeRunTask(shutdown_behavior)) | 189 if (!BeforeRunTask(shutdown_behavior)) |
| 190 return; | 190 return; |
| 191 | 191 |
| 192 // All tasks run through here and the scheduler itself doesn't use singletons. | 192 // All tasks run through here and the scheduler itself doesn't use singletons. |
| 193 // Therefore, it isn't necessary to reset the singleton allowed bit after | 193 // Therefore, it isn't necessary to reset the singleton allowed bit after |
| 194 // running the task. | 194 // running the task. |
| 195 ThreadRestrictions::SetSingletonAllowed( | 195 ThreadRestrictions::SetIOAllowed( |
| 196 task->traits.shutdown_behavior() != | 196 task->traits.shutdown_behavior() != |
| 197 TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN); | 197 TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN); |
| 198 | 198 |
| 199 { | 199 { |
| 200 // Set up SequenceToken as expected for the scope of the task. | 200 // Set up SequenceToken as expected for the scope of the task. |
| 201 ScopedSetSequenceTokenForCurrentThread | 201 ScopedSetSequenceTokenForCurrentThread |
| 202 scoped_set_sequence_token_for_current_thread(sequence->token()); | 202 scoped_set_sequence_token_for_current_thread(sequence->token()); |
| 203 | 203 |
| 204 // Set up TaskRunnerHandle as expected for the scope of the task. | 204 // Set up TaskRunnerHandle as expected for the scope of the task. |
| 205 std::unique_ptr<SequencedTaskRunnerHandle> sequenced_task_runner_handle; | 205 std::unique_ptr<SequencedTaskRunnerHandle> sequenced_task_runner_handle; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 // This method can only be called after shutdown has started. | 331 // This method can only be called after shutdown has started. |
| 332 DCHECK(state_->HasShutdownStarted()); | 332 DCHECK(state_->HasShutdownStarted()); |
| 333 DCHECK(shutdown_event_); | 333 DCHECK(shutdown_event_); |
| 334 | 334 |
| 335 shutdown_event_->Signal(); | 335 shutdown_event_->Signal(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace internal | 338 } // namespace internal |
| 339 } // namespace base | 339 } // namespace base |
| OLD | NEW |