1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef GIN_V8_FOREGROUND_TASK_RUNNER_BASE_H_
6 #define GIN_V8_FOREGROUND_TASK_RUNNER_BASE_H_
8 #include "v8/include/v8-platform.h"
10 #include "gin/gin_export.h"
11 #include "gin/public/v8_idle_task_runner.h"
15 // Base class for the V8ForegroundTaskRunners to share the capability of
16 // enabling IdleTasks.
17 class V8ForegroundTaskRunnerBase : public v8::TaskRunner {
19 V8ForegroundTaskRunnerBase();
21 ~V8ForegroundTaskRunnerBase() override;
23 void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner);
25 bool IdleTasksEnabled() override;
28 V8IdleTaskRunner* idle_task_runner() { return idle_task_runner_.get(); }
31 std::unique_ptr<V8IdleTaskRunner> idle_task_runner_;
36 #endif // GIN_V8_FOREGROUND_TASK_RUNNER_BASE_H_