11cb0ef41Sopenharmony_ci// Copyright 2018 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_OBJECTS_MICROTASK_H_
61cb0ef41Sopenharmony_ci#define V8_OBJECTS_MICROTASK_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/objects/objects.h"
91cb0ef41Sopenharmony_ci#include "src/objects/struct.h"
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci// Has to be the last include (doesn't have include guards):
121cb0ef41Sopenharmony_ci#include "src/objects/object-macros.h"
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_cinamespace v8 {
151cb0ef41Sopenharmony_cinamespace internal {
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciclass StructBodyDescriptor;
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci#include "torque-generated/src/objects/microtask-tq.inc"
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci// Abstract base class for all microtasks that can be scheduled on the
221cb0ef41Sopenharmony_ci// microtask queue. This class merely serves the purpose of a marker
231cb0ef41Sopenharmony_ci// interface.
241cb0ef41Sopenharmony_ciclass Microtask : public TorqueGeneratedMicrotask<Microtask, Struct> {
251cb0ef41Sopenharmony_ci public:
261cb0ef41Sopenharmony_ci  TQ_OBJECT_CONSTRUCTORS(Microtask)
271cb0ef41Sopenharmony_ci};
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci// A CallbackTask is a special Microtask that allows us to schedule
301cb0ef41Sopenharmony_ci// C++ microtask callbacks on the microtask queue. This is heavily
311cb0ef41Sopenharmony_ci// used by Blink for example.
321cb0ef41Sopenharmony_ciclass CallbackTask
331cb0ef41Sopenharmony_ci    : public TorqueGeneratedCallbackTask<CallbackTask, Microtask> {
341cb0ef41Sopenharmony_ci public:
351cb0ef41Sopenharmony_ci  using BodyDescriptor = StructBodyDescriptor;
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci  TQ_OBJECT_CONSTRUCTORS(CallbackTask)
381cb0ef41Sopenharmony_ci};
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci// A CallableTask is a special (internal) Microtask that allows us to
411cb0ef41Sopenharmony_ci// schedule arbitrary callables on the microtask queue. We use this
421cb0ef41Sopenharmony_ci// for various tests of the microtask queue.
431cb0ef41Sopenharmony_ciclass CallableTask
441cb0ef41Sopenharmony_ci    : public TorqueGeneratedCallableTask<CallableTask, Microtask> {
451cb0ef41Sopenharmony_ci public:
461cb0ef41Sopenharmony_ci  // Dispatched behavior.
471cb0ef41Sopenharmony_ci  DECL_VERIFIER(CallableTask)
481cb0ef41Sopenharmony_ci  void BriefPrintDetails(std::ostream& os);
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ci  using BodyDescriptor = StructBodyDescriptor;
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci  TQ_OBJECT_CONSTRUCTORS(CallableTask)
531cb0ef41Sopenharmony_ci};
541cb0ef41Sopenharmony_ci
551cb0ef41Sopenharmony_ci}  // namespace internal
561cb0ef41Sopenharmony_ci}  // namespace v8
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci#include "src/objects/object-macros-undef.h"
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ci#endif  // V8_OBJECTS_MICROTASK_H_
61