mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
PR-URL: https://github.com/nodejs/node/pull/60893 Fixes: https://github.com/nodejs/node/issues/60888 Fixes: https://github.com/nodejs/node/issues/59515 Fixes: https://github.com/nodejs/node/issues/56542 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
#ifndef SRC_ENCODING_BINDING_H_
|
|
#define SRC_ENCODING_BINDING_H_
|
|
|
|
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
|
|
#include <cinttypes>
|
|
#include "aliased_buffer.h"
|
|
#include "node_snapshotable.h"
|
|
#include "v8-fast-api-calls.h"
|
|
|
|
namespace node {
|
|
class ExternalReferenceRegistry;
|
|
|
|
namespace encoding_binding {
|
|
class BindingData : public SnapshotableObject {
|
|
public:
|
|
struct InternalFieldInfo : public node::InternalFieldInfoBase {
|
|
AliasedBufferIndex encode_into_results_buffer;
|
|
};
|
|
|
|
BindingData(Realm* realm,
|
|
v8::Local<v8::Object> obj,
|
|
InternalFieldInfo* info = nullptr);
|
|
SERIALIZABLE_OBJECT_METHODS()
|
|
SET_BINDING_ID(encoding_binding_data)
|
|
|
|
void MemoryInfo(MemoryTracker* tracker) const override;
|
|
SET_SELF_SIZE(BindingData)
|
|
SET_MEMORY_INFO_NAME(BindingData)
|
|
|
|
static void EncodeInto(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
static void EncodeUtf8String(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
static void DecodeUTF8(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
static void DecodeWindows1252(
|
|
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
static void ToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void CreatePerIsolateProperties(IsolateData* isolate_data,
|
|
v8::Local<v8::ObjectTemplate> target);
|
|
static void CreatePerContextProperties(v8::Local<v8::Object> target,
|
|
v8::Local<v8::Value> unused,
|
|
v8::Local<v8::Context> context,
|
|
void* priv);
|
|
static void RegisterTimerExternalReferences(
|
|
ExternalReferenceRegistry* registry);
|
|
|
|
private:
|
|
static constexpr size_t kEncodeIntoResultsLength = 2;
|
|
AliasedUint32Array encode_into_results_buffer_;
|
|
InternalFieldInfo* internal_field_info_ = nullptr;
|
|
};
|
|
|
|
} // namespace encoding_binding
|
|
|
|
} // namespace node
|
|
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
|
|
#endif // SRC_ENCODING_BINDING_H_
|