Andreas Haas | c13cae8 | 2017-11-16 12:54:38 | [diff] [blame] | 1 | // Copyright 2017 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 | #ifndef V8_FOREGROUND_TASK_RUNNER_H |
| 6 | #define V8_FOREGROUND_TASK_RUNNER_H |
| 7 | |
| 8 | #include "base/memory/ref_counted.h" |
| 9 | #include "gin/v8_foreground_task_runner_base.h" |
| 10 | |
| 11 | namespace base { |
| 12 | class SingleThreadTaskRunner; |
| 13 | } |
| 14 | |
| 15 | namespace gin { |
| 16 | |
| 17 | class V8ForegroundTaskRunner : public V8ForegroundTaskRunnerBase { |
| 18 | public: |
| 19 | V8ForegroundTaskRunner( |
| 20 | scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 21 | |
| 22 | ~V8ForegroundTaskRunner() override; |
| 23 | |
| 24 | // v8::Platform implementation. |
| 25 | void PostTask(std::unique_ptr<v8::Task> task) override; |
| 26 | |
| 27 | void PostDelayedTask(std::unique_ptr<v8::Task> task, |
| 28 | double delay_in_seconds) override; |
| 29 | |
| 30 | void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override; |
| 31 | |
| 32 | private: |
| 33 | scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 34 | }; |
| 35 | |
| 36 | } // namespace gin |
| 37 | |
| 38 | #endif // V8_FOREGROUND_TASK_RUNNER_H |