blob: 8289d909dc41d6fe1e3f9a5555c5c59be598ea07 [file] [log] [blame]
Scott Graham66962112018-06-08 12:42:08 -07001// 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
11namespace base {
12namespace internal {
13
14TaskTrackerPosix::TaskTrackerPosix(StringPiece name) : TaskTracker(name) {}
15TaskTrackerPosix::~TaskTrackerPosix() = default;
16
17void 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()
27bool TaskTrackerPosix::IsPostingBlockShutdownTaskAfterShutdownAllowed() {
28 return service_thread_handle_.is_equal(PlatformThread::CurrentHandle());
29}
30#endif
31
32} // namespace internal
33} // namespace base