blob: 82262aeed42adde490f878c576419910cc3f1620 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/JobCallback.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/Promise.h>
namespace JS {
class PromiseReactionJob final : public NativeFunction {
JS_OBJECT(PromiseReactionJob, NativeFunction);
public:
static PromiseReactionJob* create(GlobalObject&, PromiseReaction&, Value argument);
explicit PromiseReactionJob(PromiseReaction&, Value argument, Object& prototype);
virtual ~PromiseReactionJob() override = default;
virtual Value call() override;
private:
virtual void visit_edges(Visitor&) override;
PromiseReaction& m_reaction;
Value m_argument;
};
class PromiseResolveThenableJob final : public NativeFunction {
JS_OBJECT(PromiseReactionJob, NativeFunction);
public:
static PromiseResolveThenableJob* create(GlobalObject&, Promise&, Value thenable, JobCallback then);
explicit PromiseResolveThenableJob(Promise&, Value thenable, JobCallback then, Object& prototype);
virtual ~PromiseResolveThenableJob() override = default;
virtual Value call() override;
private:
virtual void visit_edges(Visitor&) override;
Promise& m_promise_to_resolve;
Value m_thenable;
JobCallback m_then;
};
}
|