quic: update more of the quic to the new compile guard · nodejs/node@b91a934
11#pragma once
2233#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4-#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
5465#include <base_object.h>
76#include <env.h>
@@ -26,32 +25,32 @@ class Packet;
2625// The FunctionTemplates the BindingData will store for us.
2726#define QUIC_CONSTRUCTORS(V) \
2827V(endpoint) \
28+V(http3application) \
2929V(logstream) \
3030V(packet) \
3131V(session) \
3232V(stream) \
33-V(udp) \
34-V(http3application)
33+V(udp)
35343635// The callbacks are persistent v8::Function references that are set in the
3736// quic::BindingState used to communicate data and events back out to the JS
3837// environment. They are set once from the JavaScript side when the
3938// internalBinding('quic') is first loaded.
4039#define QUIC_JS_CALLBACKS(V) \
4140V(endpoint_close, EndpointClose) \
42-V(session_new, SessionNew) \
4341V(session_close, SessionClose) \
4442V(session_datagram, SessionDatagram) \
4543V(session_datagram_status, SessionDatagramStatus) \
4644V(session_handshake, SessionHandshake) \
45+V(session_new, SessionNew) \
46+V(session_path_validation, SessionPathValidation) \
4747V(session_ticket, SessionTicket) \
4848V(session_version_negotiation, SessionVersionNegotiation) \
49-V(session_path_validation, SessionPathValidation) \
49+V(stream_blocked, StreamBlocked) \
5050V(stream_close, StreamClose) \
5151V(stream_created, StreamCreated) \
52-V(stream_reset, StreamReset) \
5352V(stream_headers, StreamHeaders) \
54-V(stream_blocked, StreamBlocked) \
53+V(stream_reset, StreamReset) \
5554V(stream_trailers, StreamTrailers)
56555756// The various JS strings the implementation uses.
@@ -64,10 +63,10 @@ class Packet;
6463V(application_provider, "provider") \
6564V(bbr, "bbr") \
6665V(ca, "ca") \
67-V(certs, "certs") \
6866V(cc_algorithm, "cc") \
69-V(crl, "crl") \
67+V(certs, "certs") \
7068V(ciphers, "ciphers") \
69+V(crl, "crl") \
7170V(cubic, "cubic") \
7271V(disable_stateless_reset, "disableStatelessReset") \
7372V(enable_connect_protocol, "enableConnectProtocol") \
@@ -114,8 +113,8 @@ class Packet;
114113V(qpack_max_dtable_capacity, "qpackMaxDTableCapacity") \
115114V(reject_unauthorized, "rejectUnauthorized") \
116115V(reno, "reno") \
117-V(retry_token_expiration, "retryTokenExpiration") \
118116V(reset_token_secret, "resetTokenSecret") \
117+V(retry_token_expiration, "retryTokenExpiration") \
119118V(rx_loss, "rxDiagnosticLoss") \
120119V(servername, "servername") \
121120V(session, "Session") \
@@ -150,6 +149,9 @@ class BindingData final
150149static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
151150152151static BindingData& Get(Environment* env);
152+static inline BindingData& Get(Realm* realm) {
153+return Get(realm->env());
154+ }
153155154156BindingData(Realm* realm, v8::Local<v8::Object> object);
155157DISALLOW_COPY_AND_MOVE(BindingData)
@@ -179,6 +181,7 @@ class BindingData final
179181180182bool in_ngtcp2_callback_scope = false;
181183bool in_nghttp3_callback_scope = false;
184+size_t current_ngtcp2_memory_ = 0;
182185183186// The following set up various storage and accessors for common strings,
184187// construction templates, and callbacks stored on the BindingData. These
@@ -205,8 +208,6 @@ class BindingData final
205208QUIC_JS_CALLBACKS(V)
206209#undef V
207210208-size_t current_ngtcp2_memory_ = 0;
209-210211#define V(name) v8::Global<v8::FunctionTemplate> name##_constructor_template_;
211212QUIC_CONSTRUCTORS(V)
212213#undef V
@@ -229,15 +230,15 @@ void IllegalConstructor(const v8::FunctionCallbackInfo<v8::Value>& args);
229230// The ngtcp2 and nghttp3 callbacks have certain restrictions
230231// that forbid re-entry. We provide the following scopes for
231232// use in those to help protect against it.
232-struct NgTcp2CallbackScope {
233+struct NgTcp2CallbackScope final {
233234 Environment* env;
234235explicit NgTcp2CallbackScope(Environment* env);
235236DISALLOW_COPY_AND_MOVE(NgTcp2CallbackScope)
236237~NgTcp2CallbackScope();
237238static bool in_ngtcp2_callback(Environment* env);
238239};
239240240-struct NgHttp3CallbackScope {
241+struct NgHttp3CallbackScope final {
241242 Environment* env;
242243explicit NgHttp3CallbackScope(Environment* env);
243244DISALLOW_COPY_AND_MOVE(NgHttp3CallbackScope)
@@ -268,5 +269,4 @@ struct CallbackScope final : public CallbackScopeBase {
268269269270} // namespace node::quic
270271271-#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
272272#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS