src: reorganize ContextifyFunction methods

PR-URL: https://github.com/nodejs/node/pull/58434
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Chengzhong Wu authored and Antoine du Hamel committed 2025-06-10 14:52:22 +02:00
1 parent 7521077299
commit 31058b8785
4 files changed
+67 -46

No files matched your search

+23 -18
View File
@@ -86,18 +86,6 @@ class ContextifyContext : public BaseObject {
static bool IsStillInitializing(const ContextifyContext* ctx);
static void MakeContext(const v8::FunctionCallbackInfo<v8::Value>& args);
static void IsContext(const v8::FunctionCallbackInfo<v8::Value>& args);
static void CompileFunction(
const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::MaybeLocal<v8::Object> CompileFunctionAndCacheResult(
Environment* env,
v8::Local<v8::Context> parsing_context,
v8::ScriptCompiler::Source* source,
v8::LocalVector<v8::String> params,
v8::LocalVector<v8::Object> context_extensions,
v8::ScriptCompiler::CompileOptions options,
bool produce_cached_data,
v8::Local<v8::Symbol> id_symbol,
const errors::TryCatchScope& try_catch);
static v8::Intercepted PropertyQueryCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Integer>& args);
@@ -177,6 +165,29 @@ class ContextifyScript : public BaseObject {
v8::Global<v8::UnboundScript> script_;
};
class ContextifyFunction final {
public:
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
static void CreatePerIsolateProperties(IsolateData* isolate_data,
v8::Local<v8::ObjectTemplate> target);
static void CompileFunction(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::MaybeLocal<v8::Object> CompileFunctionAndCacheResult(
Environment* env,
v8::Local<v8::Context> parsing_context,
v8::ScriptCompiler::Source* source,
v8::LocalVector<v8::String> params,
v8::LocalVector<v8::Object> context_extensions,
v8::ScriptCompiler::CompileOptions options,
bool produce_cached_data,
v8::Local<v8::Symbol> id_symbol,
const errors::TryCatchScope& try_catch);
private:
ContextifyFunction() = delete;
~ContextifyFunction() = delete;
};
v8::Maybe<void> StoreCodeCacheResult(
Environment* env,
v8::Local<v8::Object> target,
@@ -185,12 +196,6 @@ v8::Maybe<void> StoreCodeCacheResult(
bool produce_cached_data,
std::unique_ptr<v8::ScriptCompiler::CachedData> new_cached_data);
v8::MaybeLocal<v8::Function> CompileFunction(
v8::Local<v8::Context> context,
v8::Local<v8::String> filename,
v8::Local<v8::String> content,
v8::LocalVector<v8::String>* parameters);
} // namespace contextify
} // namespace node