chromium/v8/include/v8-promise.h

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef INCLUDE_V8_PROMISE_H_
#define INCLUDE_V8_PROMISE_H_

#include "v8-local-handle.h"  // NOLINT(build/include_directory)
#include "v8-object.h"        // NOLINT(build/include_directory)
#include "v8config.h"         // NOLINT(build/include_directory)

namespace v8 {

class Context;

#ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
// Defined using gn arg `v8_promise_internal_field_count`.
#define V8_PROMISE_INTERNAL_FIELD_COUNT
#endif

/**
 * An instance of the built-in Promise constructor (ES6 draft).
 */
class V8_EXPORT Promise : public Object {};

/**
 * PromiseHook with type kInit is called when a new promise is
 * created. When a new promise is created as part of the chain in the
 * case of Promise.then or in the intermediate promises created by
 * Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise
 * otherwise we pass undefined.
 *
 * PromiseHook with type kResolve is called at the beginning of
 * resolve or reject function defined by CreateResolvingFunctions.
 *
 * PromiseHook with type kBefore is called at the beginning of the
 * PromiseReactionJob.
 *
 * PromiseHook with type kAfter is called right at the end of the
 * PromiseReactionJob.
 */
enum class PromiseHookType {};

PromiseHook;

// --- Promise Reject Callback ---
enum PromiseRejectEvent {};

class PromiseRejectMessage {};

PromiseRejectCallback;

}  // namespace v8

#endif  // INCLUDE_V8_PROMISE_H_