v8-microtask.h 861 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2021 the V8 project 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 INCLUDE_V8_MICROTASK_H_
  5. #define INCLUDE_V8_MICROTASK_H_
  6. namespace v8 {
  7. class Isolate;
  8. // --- Microtasks Callbacks ---
  9. using MicrotasksCompletedCallbackWithData = void (*)(Isolate*, void*);
  10. using MicrotaskCallback = void (*)(void* data);
  11. /**
  12. * Policy for running microtasks:
  13. * - explicit: microtasks are invoked with the
  14. * Isolate::PerformMicrotaskCheckpoint() method;
  15. * - scoped: microtasks invocation is controlled by MicrotasksScope objects;
  16. * - auto: microtasks are invoked when the script call depth decrements
  17. * to zero.
  18. */
  19. enum class MicrotasksPolicy { kExplicit, kScoped, kAuto };
  20. } // namespace v8
  21. #endif // INCLUDE_V8_MICROTASK_H_