Scott Graham | 6696211 | 2018-06-08 12:42:08 -0700 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/task_scheduler/task_tracker_posix.h" |
| 6 | |
| 7 | #include <utility> |
| 8 | |
| 9 | #include "base/files/file_descriptor_watcher_posix.h" |
| 10 | |
| 11 | namespace base { |
| 12 | namespace internal { |
| 13 | |
| 14 | TaskTrackerPosix::TaskTrackerPosix(StringPiece name) : TaskTracker(name) {} |
| 15 | TaskTrackerPosix::~TaskTrackerPosix() = default; |
| 16 | |
| 17 | void TaskTrackerPosix::RunOrSkipTask(Task task, |
| 18 | Sequence* sequence, |
| 19 | bool can_run_task) { |
| 20 | DCHECK(watch_file_descriptor_message_loop_); |
| 21 | FileDescriptorWatcher file_descriptor_watcher( |
| 22 | watch_file_descriptor_message_loop_); |
| 23 | TaskTracker::RunOrSkipTask(std::move(task), sequence, can_run_task); |
| 24 | } |
| 25 | |
| 26 | #if DCHECK_IS_ON() |
| 27 | bool TaskTrackerPosix::IsPostingBlockShutdownTaskAfterShutdownAllowed() { |
| 28 | return service_thread_handle_.is_equal(PlatformThread::CurrentHandle()); |
| 29 | } |
| 30 | #endif |
| 31 | |
| 32 | } // namespace internal |
| 33 | } // namespace base |