v8_foreground_task_runner.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef GIN_V8_FOREGROUND_TASK_RUNNER_H_
  5. #define GIN_V8_FOREGROUND_TASK_RUNNER_H_
  6. #include "base/memory/ref_counted.h"
  7. #include "gin/v8_foreground_task_runner_base.h"
  8. namespace base {
  9. class SingleThreadTaskRunner;
  10. }
  11. namespace gin {
  12. class V8ForegroundTaskRunner : public V8ForegroundTaskRunnerBase {
  13. public:
  14. V8ForegroundTaskRunner(
  15. scoped_refptr<base::SingleThreadTaskRunner> task_runner);
  16. ~V8ForegroundTaskRunner() override;
  17. // v8::Platform implementation.
  18. void PostTask(std::unique_ptr<v8::Task> task) override;
  19. void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
  20. void PostDelayedTask(std::unique_ptr<v8::Task> task,
  21. double delay_in_seconds) override;
  22. void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task,
  23. double delay_in_seconds) override;
  24. void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
  25. bool NonNestableTasksEnabled() const override;
  26. bool NonNestableDelayedTasksEnabled() const override;
  27. private:
  28. scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
  29. };
  30. } // namespace gin
  31. #endif // GIN_V8_FOREGROUND_TASK_RUNNER_H_