The C and C++ Include Header Files
/usr/include/nodejs/src/node_contextify.h
$ cat -n /usr/include/nodejs/src/node_contextify.h 1 #ifndef SRC_NODE_CONTEXTIFY_H_ 2 #define SRC_NODE_CONTEXTIFY_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include "base_object-inl.h" 7 #include "node_context_data.h" 8 #include "node_errors.h" 9 10 namespace node { 11 namespace contextify { 12 13 struct ContextOptions { 14 v8::Local
name; 15 v8::Local
origin; 16 v8::Local
allow_code_gen_strings; 17 v8::Local
allow_code_gen_wasm; 18 }; 19 20 class ContextifyContext { 21 public: 22 enum InternalFields { kSlot, kInternalFieldCount }; 23 ContextifyContext(Environment* env, 24 v8::Local
sandbox_obj, 25 const ContextOptions& options); 26 ~ContextifyContext(); 27 static void CleanupHook(void* arg); 28 29 v8::MaybeLocal
CreateDataWrapper(Environment* env); 30 v8::MaybeLocal
CreateV8Context(Environment* env, 31 v8::Local
sandbox_obj, 32 const ContextOptions& options); 33 static void Init(Environment* env, v8::Local
target); 34 35 static ContextifyContext* ContextFromContextifiedSandbox( 36 Environment* env, 37 const v8::Local
& sandbox); 38 39 inline Environment* env() const { 40 return env_; 41 } 42 43 inline v8::Local
context() const { 44 return PersistentToLocal::Default(env()->isolate(), context_); 45 } 46 47 inline v8::Local
global_proxy() const { 48 return context()->Global(); 49 } 50 51 inline v8::Local
sandbox() const { 52 return v8::Local
::Cast( 53 context()->GetEmbedderData(ContextEmbedderIndex::kSandboxObject)); 54 } 55 56 57 template
58 static ContextifyContext* Get(const v8::PropertyCallbackInfo
& args); 59 60 private: 61 static void MakeContext(const v8::FunctionCallbackInfo
& args); 62 static void IsContext(const v8::FunctionCallbackInfo
& args); 63 static void CompileFunction( 64 const v8::FunctionCallbackInfo
& args); 65 static void WeakCallback( 66 const v8::WeakCallbackInfo
& data); 67 static void PropertyGetterCallback( 68 v8::Local
property, 69 const v8::PropertyCallbackInfo
& args); 70 static void PropertySetterCallback( 71 v8::Local
property, 72 v8::Local
value, 73 const v8::PropertyCallbackInfo
& args); 74 static void PropertyDescriptorCallback( 75 v8::Local
property, 76 const v8::PropertyCallbackInfo
& args); 77 static void PropertyDefinerCallback( 78 v8::Local
property, 79 const v8::PropertyDescriptor& desc, 80 const v8::PropertyCallbackInfo
& args); 81 static void PropertyDeleterCallback( 82 v8::Local
property, 83 const v8::PropertyCallbackInfo
& args); 84 static void PropertyEnumeratorCallback( 85 const v8::PropertyCallbackInfo
& args); 86 static void IndexedPropertyGetterCallback( 87 uint32_t index, 88 const v8::PropertyCallbackInfo
& args); 89 static void IndexedPropertySetterCallback( 90 uint32_t index, 91 v8::Local
value, 92 const v8::PropertyCallbackInfo
& args); 93 static void IndexedPropertyDescriptorCallback( 94 uint32_t index, 95 const v8::PropertyCallbackInfo
& args); 96 static void IndexedPropertyDefinerCallback( 97 uint32_t index, 98 const v8::PropertyDescriptor& desc, 99 const v8::PropertyCallbackInfo
& args); 100 static void IndexedPropertyDeleterCallback( 101 uint32_t index, 102 const v8::PropertyCallbackInfo
& args); 103 Environment* const env_; 104 v8::Global
context_; 105 }; 106 107 class ContextifyScript : public BaseObject { 108 public: 109 SET_NO_MEMORY_INFO() 110 SET_MEMORY_INFO_NAME(ContextifyScript) 111 SET_SELF_SIZE(ContextifyScript) 112 113 ContextifyScript(Environment* env, v8::Local
object); 114 ~ContextifyScript() override; 115 116 static void Init(Environment* env, v8::Local
target); 117 static void New(const v8::FunctionCallbackInfo
& args); 118 static bool InstanceOf(Environment* env, const v8::Local
& args); 119 static void CreateCachedData( 120 const v8::FunctionCallbackInfo
& args); 121 static void RunInThisContext(const v8::FunctionCallbackInfo
& args); 122 static void RunInContext(const v8::FunctionCallbackInfo
& args); 123 static bool EvalMachine(Environment* env, 124 const int64_t timeout, 125 const bool display_errors, 126 const bool break_on_sigint, 127 const bool break_on_first_line, 128 const v8::FunctionCallbackInfo
& args); 129 130 inline uint32_t id() { return id_; } 131 132 private: 133 v8::Global
script_; 134 uint32_t id_; 135 }; 136 137 class CompiledFnEntry final : public BaseObject { 138 public: 139 SET_NO_MEMORY_INFO() 140 SET_MEMORY_INFO_NAME(CompiledFnEntry) 141 SET_SELF_SIZE(CompiledFnEntry) 142 143 CompiledFnEntry(Environment* env, 144 v8::Local
object, 145 uint32_t id, 146 v8::Local
script); 147 ~CompiledFnEntry(); 148 149 private: 150 uint32_t id_; 151 v8::Global
script_; 152 153 static void WeakCallback(const v8::WeakCallbackInfo
& data); 154 }; 155 156 } // namespace contextify 157 } // namespace node 158 159 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 160 161 #endif // SRC_NODE_CONTEXTIFY_H_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2024 MyWebUniversity.com ™