File: Forward.h

package info (click to toggle)
webkit2gtk 2.48.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 429,620 kB
  • sloc: cpp: 3,696,936; javascript: 194,444; ansic: 169,997; python: 46,499; asm: 19,276; ruby: 18,528; perl: 16,602; xml: 4,650; yacc: 2,360; sh: 2,098; java: 1,993; lex: 1,327; pascal: 366; makefile: 298
file content (299 lines) | stat: -rw-r--r-- 12,989 bytes parent folder | download | duplicates (6)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/**
 *  Copyright (C) 2006-2023 Apple Inc. All rights reserved.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 *
 */

#pragma once

#include <stddef.h>
#include <wtf/Platform.h>

#if defined(__has_feature)
#if __has_feature(objc_arc)
#define OSObjectPtr OSObjectPtrArc
#define RetainPtr RetainPtrArc
#endif
#endif

namespace WTF {

class ASCIILiteral;
class AbstractLocker;
class AtomString;
class AtomStringImpl;
class BinarySemaphore;
class CString;
class CrashOnOverflow;
class DefaultWeakPtrImpl;
class FunctionDispatcher;
class Hasher;
class Lock;
class Logger;
class MachSendRight;
class MainThreadDispatcher;
class MonotonicTime;
class OrdinalNumber;
class PrintStream;
class SHA1;
class Seconds;
class SerialFunctionDispatcher;
class GuaranteedSerialFunctionDispatcher;
class String;
class StringBuilder;
class StringImpl;
class StringView;
class SuspendableWorkQueue;
class TextPosition;
class TextStream;
class URL;
class UUID;
class UniquedStringImpl;
class WallTime;

struct AnyThreadsAccessTraits;
struct FastMalloc;
struct MainThreadAccessTraits;
template<typename> struct ObjectIdentifierMainThreadAccessTraits;
template<typename> struct ObjectIdentifierThreadSafeAccessTraits;

namespace JSONImpl {
class Array;
class Object;
template<typename> class ArrayOf;
}

#if ENABLE(MALLOC_HEAP_BREAKDOWN)
struct VectorBufferMalloc;
struct EmbeddedFixedVectorMalloc;
#else
using VectorBufferMalloc = FastMalloc;
using EmbeddedFixedVectorMalloc = FastMalloc;
#endif

template<typename> struct DefaultRefDerefTraits;

template<typename> class CompactPtr;
template<typename> class CompletionHandler;
template<typename, size_t = 0> class Deque;
template<typename Key, typename, Key> class EnumeratedArray;
template<typename, typename = WTF::EmbeddedFixedVectorMalloc> class FixedVector;
template<typename> class Function;
template<typename> struct FlatteningVariantTraits;
template<typename> struct IsSmartPtr;
template<typename, typename = AnyThreadsAccessTraits> class LazyNeverDestroyed;
template<typename T, typename Traits = typename T::MarkableTraits> class Markable;
template<typename, typename = AnyThreadsAccessTraits> class NeverDestroyed;
template<typename> class OSObjectPtr;
template<typename, typename, typename> class ObjectIdentifierGeneric;
template<typename T, typename RawValue = uint64_t> using ObjectIdentifier = ObjectIdentifierGeneric<T, ObjectIdentifierMainThreadAccessTraits<RawValue>, RawValue>;
template<typename T, typename RawValue = uint64_t> using AtomicObjectIdentifier = ObjectIdentifierGeneric<T, ObjectIdentifierThreadSafeAccessTraits<RawValue>, RawValue>;
template<typename> class Observer;
template<typename> class OptionSet;
template<typename> class Packed;
template<typename T, size_t = alignof(T)> class PackedAlignedPtr;
template<typename> struct RawPtrTraits;
template<typename T, typename = RawPtrTraits<T>> class CheckedRef;
template<typename T, typename = RawPtrTraits<T>> class CheckedPtr;
template<typename T, typename = RawPtrTraits<T>, typename = DefaultRefDerefTraits<T>> class Ref;
template<typename T, typename = RawPtrTraits<T>, typename = DefaultRefDerefTraits<T>> class RefPtr;
template<typename> class RetainPtr;
template<typename> class ScopedLambda;
template<typename> class StringBuffer;
template<typename> class StringParsingBuffer;
template<typename, typename = void> class StringTypeAdapter;
template<typename> class UniqueRef;
template<typename T, class... Args> UniqueRef<T> makeUniqueRef(Args&&...);
template<typename, size_t = 0> class VariantList;
template<typename, size_t = 0> struct VariantListConstIterator;
template<typename> struct VariantListProxy;
template<typename> struct VariantListSizer;
template<typename, size_t = 0, typename = CrashOnOverflow, size_t = 16, typename = VectorBufferMalloc> class Vector;
template<typename, typename WeakPtrImpl = DefaultWeakPtrImpl, typename = RawPtrTraits<WeakPtrImpl>> class WeakPtr;
template<typename, typename = DefaultWeakPtrImpl> class WeakRef;

template<typename> struct DefaultHash;
template<> struct DefaultHash<AtomString>;
template<typename T> struct DefaultHash<OptionSet<T>>;
template<> struct DefaultHash<String>;
template<> struct DefaultHash<StringImpl*>;
template<> struct DefaultHash<URL>;
template<typename T, size_t inlineCapacity> struct DefaultHash<Vector<T, inlineCapacity>>;

template<typename> struct RawValueTraits;
template<typename> struct EnumTraits;
template<typename> struct EnumTraitsForPersistence;
template<typename E, E...> struct EnumValues;
template<typename> struct HashTraits;

struct HashTableTraits;
struct IdentityExtractor;
template<typename T> struct KeyValuePairKeyExtractor;
template<typename KeyTraits, typename MappedTraits> struct KeyValuePairTraits;
template<typename KeyTypeArg, typename ValueTypeArg> struct KeyValuePair;
enum class ShouldValidateKey : bool { No, Yes };
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, ShouldValidateKey shouldValidateKey = ShouldValidateKey::Yes> class HashTable;
template<typename Value, typename = DefaultHash<Value>, typename = HashTraits<Value>> class HashCountedSet;
template<typename KeyArg, typename MappedArg, typename = DefaultHash<KeyArg>, typename = HashTraits<KeyArg>, typename = HashTraits<MappedArg>, typename = HashTableTraits, ShouldValidateKey = ShouldValidateKey::Yes> class HashMap;
template<typename KeyArg, typename MappedArg, typename KeyHash = DefaultHash<KeyArg>, typename KeyTraits = HashTraits<KeyArg>, typename MappedTraits = HashTraits<MappedArg>, typename HashTraits = HashTableTraits>
using UncheckedKeyHashMap = HashMap<KeyArg, MappedArg, KeyHash, KeyTraits, MappedTraits, HashTraits, ShouldValidateKey::No>;
template<typename ValueArg, typename = DefaultHash<ValueArg>, typename = HashTraits<ValueArg>, typename = HashTableTraits, ShouldValidateKey = ShouldValidateKey::Yes> class HashSet;
template<typename ValueArg, typename HashArg = DefaultHash<ValueArg>, typename TraitsArg = HashTraits<ValueArg>, typename TableTraitsArg = HashTableTraits>
using UncheckedKeyHashSet = HashSet<ValueArg, HashArg, TraitsArg, TableTraitsArg, ShouldValidateKey::No>;
template<typename ResolveValueT, typename RejectValueT, unsigned options = 0> class NativePromise;
using GenericPromise = NativePromise<void, void>;
using GenericNonExclusivePromise = NativePromise<void, void, 1>;
class NativePromiseRequest;
}

namespace JSON {
using namespace WTF::JSONImpl;
}

namespace std {
namespace experimental {
inline namespace fundamentals_v3 {
template<class, class> class expected;
template<class> class unexpected;
}}} // namespace std::experimental::fundamentals_v3

using WTF::ASCIILiteral;
using WTF::AbstractLocker;
using WTF::AtomString;
using WTF::AtomStringImpl;
using WTF::AtomicObjectIdentifier;
using WTF::BinarySemaphore;
using WTF::CString;
using WTF::CompletionHandler;
using WTF::Deque;
using WTF::EnumeratedArray;
using WTF::FixedVector;
using WTF::Function;
using WTF::FunctionDispatcher;
using WTF::GenericPromise;
using WTF::HashCountedSet;
using WTF::HashMap;
using WTF::HashSet;
using WTF::Hasher;
using WTF::LazyNeverDestroyed;
using WTF::Lock;
using WTF::Logger;
using WTF::MachSendRight;
using WTF::MainThreadDispatcher;
using WTF::makeUniqueRef;
using WTF::MonotonicTime;
using WTF::NativePromise;
using WTF::NativePromiseRequest;
using WTF::NeverDestroyed;
using WTF::OSObjectPtr;
using WTF::ObjectIdentifier;
using WTF::ObjectIdentifierGeneric;
using WTF::Observer;
using WTF::OptionSet;
using WTF::OrdinalNumber;
using WTF::PrintStream;
using WTF::RawPtrTraits;
using WTF::RawValueTraits;
using WTF::Ref;
using WTF::GuaranteedSerialFunctionDispatcher;
using WTF::RefPtr;
using WTF::RetainPtr;
using WTF::SHA1;
using WTF::ScopedLambda;
using WTF::SerialFunctionDispatcher;
using WTF::String;
using WTF::StringBuffer;
using WTF::StringBuilder;
using WTF::StringImpl;
using WTF::StringParsingBuffer;
using WTF::StringView;
using WTF::SuspendableWorkQueue;
using WTF::TextPosition;
using WTF::TextStream;
using WTF::URL;
using WTF::UncheckedKeyHashMap;
using WTF::UncheckedKeyHashSet;
using WTF::UniqueRef;
using WTF::Vector;
using WTF::WeakPtr;
using WTF::WeakRef;

template<class T, class E> using Expected = std::experimental::expected<T, E>;
template<class E> using Unexpected = std::experimental::unexpected<E>;

// Sometimes an inline method simply forwards to another one and does nothing else. If it were
// just a forward declaration of that method then you would only need a forward declaration of
// its return types and parameter types too, but because it's inline and it actually needs to
// return / pass these types (even though it's just passing through whatever it called) you
// now find yourself having to actually have a full declaration of these types. That might be
// an include you'd rather avoid.
//
// No more. Enter template magic to lazily instantiate that method!
//
// This macro makes the method work as if you'd declared the return / parameter types as normal,
// but forces lazy instantiation of the method at the call site, at which point the caller (not
// the declaration) had better have a full declaration of the return / parameter types.
//
// Simply pass the forward-declared types to the macro, with an alias for each, and then define
// your function as you otherwise would have but using the aliased name. Why the alias? So you
// can be lazy on templated types! Sample usage:
//
// struct Foo; // No need to define Foo!
// template<typename T>
// struct A {
//     Foo declared(Bar); // Forward declarations of Foo and Bar are sufficient here.
//     // The below code would normally require a definition of Foo and Bar.
//     WTF_LAZY_INSTANTIATE(Foo=Foo, Bar=Bar) Foo forwarder(Bar b) { return declared(b); }
// };
#define WTF_LAZY_JOIN_UNLAZE(A, B) A##B
#define WTF_LAZY_JOIN(A, B) WTF_LAZY_JOIN_UNLAZE(A, B)
#define WTF_LAZY_ARGUMENT_NUMBER(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
#define WTF_LAZY_AUGMENT(...) unused, __VA_ARGS__
#define WTF_LAZY_EXPAND(x) x
#define WTF_LAZY_NUM_ARGS_(...) WTF_LAZY_EXPAND(WTF_LAZY_ARGUMENT_NUMBER(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0))
#define WTF_LAZY_NUM_ARGS(...) WTF_LAZY_NUM_ARGS_(WTF_LAZY_AUGMENT(__VA_ARGS__))
#define WTF_LAZY_FOR_EACH_TERM(F, ...) \
    WTF_LAZY_JOIN(WTF_LAZY_FOR_EACH_TERM_, WTF_LAZY_NUM_ARGS(__VA_ARGS__))(F, (__VA_ARGS__))
#define WTF_LAZY_FIRST(_1, ...) _1
#define WTF_LAZY_REST(_1, ...) (__VA_ARGS__)
#define WTF_LAZY_REST_(_1, ...) __VA_ARGS__
#define WTF_LAZY_CALL(F, ARG) F(ARG)
#define WTF_LAZY_FOR_EACH_TERM_0(...)
#define WTF_LAZY_FOR_EACH_TERM_1(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_0(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_FOR_EACH_TERM_2(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_1(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_FOR_EACH_TERM_3(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_2(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_FOR_EACH_TERM_4(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_3(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_FOR_EACH_TERM_5(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_4(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_FOR_EACH_TERM_6(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_5(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_FOR_EACH_TERM_7(F, ARGS) WTF_LAZY_CALL(F, WTF_LAZY_FIRST ARGS) WTF_LAZY_FOR_EACH_TERM_6(F, WTF_LAZY_REST ARGS)
#define WTF_LAZY_DECLARE_ALIAS_AND_TYPE(ALIAS_AND_TYPE) typename ALIAS_AND_TYPE,
#define WTF_LAZY_INSTANTIATE(...)                                        \
    template<                                                            \
    WTF_LAZY_FOR_EACH_TERM(WTF_LAZY_DECLARE_ALIAS_AND_TYPE, __VA_ARGS__) \
    typename = void>

#define WTF_LAZY_HAS_REST_0(...)
#define WTF_LAZY_HAS_REST_1(...)
#define WTF_LAZY_HAS_REST_2 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST_3 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST_4 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST_5 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST_6 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST_7 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST_8 WTF_LAZY_EXPAND
#define WTF_LAZY_HAS_REST(...) \
    WTF_LAZY_JOIN(WTF_LAZY_HAS_REST_, WTF_LAZY_NUM_ARGS(__VA_ARGS__))