| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_NON_MAIN_THREAD_TASK_QUEUE_H_ |
| #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_NON_MAIN_THREAD_TASK_QUEUE_H_ |
| |
| #include "base/task/sequence_manager/task_queue_impl.h" |
| #include "third_party/blink/public/platform/task_type.h" |
| #include "third_party/blink/renderer/platform/platform_export.h" |
| |
| namespace blink { |
| namespace scheduler { |
| |
| class NonMainThreadSchedulerImpl; |
| |
| class PLATFORM_EXPORT NonMainThreadTaskQueue |
| : public base::sequence_manager::TaskQueue { |
| public: |
| // TODO(kraynov): Consider options to remove TaskQueueImpl reference here. |
| NonMainThreadTaskQueue( |
| std::unique_ptr<base::sequence_manager::internal::TaskQueueImpl> impl, |
| const Spec& spec, |
| NonMainThreadSchedulerImpl* non_main_thread_scheduler); |
| ~NonMainThreadTaskQueue() override; |
| |
| void OnTaskCompleted( |
| const base::sequence_manager::Task& task, |
| const base::sequence_manager::TaskQueue::TaskTiming& task_timing); |
| |
| scoped_refptr<base::SingleThreadTaskRunner> CreateTaskRunner( |
| TaskType task_type) { |
| return TaskQueue::CreateTaskRunner(static_cast<int>(task_type)); |
| } |
| |
| void SetPaused(bool paused); |
| |
| private: |
| std::unique_ptr<QueueEnabledVoter> task_queue_voter_; |
| |
| // Not owned. |
| NonMainThreadSchedulerImpl* non_main_thread_scheduler_; |
| }; |
| |
| } // namespace scheduler |
| } // namespace blink |
| |
| #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SCHEDULER_WORKER_NON_MAIN_THREAD_TASK_QUEUE_H_ |