Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/nodejs/src/base_object_types.h
$ cat -n /usr/include/nodejs/src/base_object_types.h 1 #ifndef SRC_BASE_OBJECT_TYPES_H_ 2 #define SRC_BASE_OBJECT_TYPES_H_ 3 4 #include
5 6 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 7 8 namespace node { 9 // List of internalBinding() data wrappers. The first argument should match 10 // what the class passes to SET_BINDING_ID(), the second argument should match 11 // the C++ class name. 12 #define SERIALIZABLE_BINDING_TYPES(V) \ 13 V(fs_binding_data, fs::BindingData) \ 14 V(v8_binding_data, v8_utils::BindingData) \ 15 V(blob_binding_data, BlobBindingData) \ 16 V(process_binding_data, process::BindingData) \ 17 V(url_binding_data, url::BindingData) 18 19 #define UNSERIALIZABLE_BINDING_TYPES(V) \ 20 V(http2_binding_data, http2::BindingData) \ 21 V(http_parser_binding_data, http_parser::BindingData) \ 22 V(quic_binding_data, quic::BindingData) 23 24 // List of (non-binding) BaseObjects that are serializable in the snapshot. 25 // The first argument should match what the type passes to 26 // SET_OBJECT_ID(), the second argument should match the C++ class 27 // name. 28 #define SERIALIZABLE_NON_BINDING_TYPES(V) \ 29 V(util_weak_reference, util::WeakReference) 30 31 // Helper list of all binding data wrapper types. 32 #define BINDING_TYPES(V) \ 33 SERIALIZABLE_BINDING_TYPES(V) \ 34 UNSERIALIZABLE_BINDING_TYPES(V) 35 36 // Helper list of all BaseObjects that implement snapshot support. 37 #define SERIALIZABLE_OBJECT_TYPES(V) \ 38 SERIALIZABLE_BINDING_TYPES(V) \ 39 SERIALIZABLE_NON_BINDING_TYPES(V) 40 41 #define V(TypeId, NativeType) k_##TypeId, 42 enum class BindingDataType : uint8_t { BINDING_TYPES(V) kBindingDataTypeCount }; 43 // Make sure that we put the bindings first so that we can also use the enums 44 // for the bindings as index to the binding data store. 45 enum class EmbedderObjectType : uint8_t { 46 BINDING_TYPES(V) SERIALIZABLE_NON_BINDING_TYPES(V) 47 // We do not need to know about all the unserializable non-binding types for 48 // now so we do not list them. 49 kEmbedderObjectTypeCount 50 }; 51 #undef V 52 53 // For now, BaseObjects only need to call this when they implement snapshot 54 // support. 55 #define SET_OBJECT_ID(TypeId) \ 56 static constexpr EmbedderObjectType type_int = EmbedderObjectType::k_##TypeId; 57 58 // Binding data should call this so that they can be looked up from the binding 59 // data store. 60 #define SET_BINDING_ID(TypeId) \ 61 static constexpr BindingDataType binding_type_int = \ 62 BindingDataType::k_##TypeId; \ 63 SET_OBJECT_ID(TypeId) \ 64 static_assert(static_cast
(type_int) == \ 65 static_cast
(binding_type_int)); 66 67 } // namespace node 68 69 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 70 71 #endif // SRC_BASE_OBJECT_TYPES_H_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™