@@ -10,8 +10,46 @@ namespace MsieJavaScriptEngine.JsRt.Edge
10
10
/// </summary>
11
11
internal static class EdgeNativeMethods
12
12
{
13
+ #region Hosting
14
+
15
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
16
+ internal static extern JsErrorCode JsParseScript ( string script , JsSourceContext sourceContext ,
17
+ string sourceUrl , out EdgeJsValue result ) ;
18
+
19
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
20
+ internal static extern JsErrorCode JsRunScript ( string script , JsSourceContext sourceContext ,
21
+ string sourceUrl , out EdgeJsValue result ) ;
22
+
23
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
24
+ internal static extern JsErrorCode JsSerializeScript ( string script , byte [ ] buffer , ref ulong bufferSize ) ;
25
+
26
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
27
+ internal static extern JsErrorCode JsParseSerializedScript ( string script , byte [ ] buffer ,
28
+ JsSourceContext sourceContext , string sourceUrl , out EdgeJsValue result ) ;
29
+
30
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
31
+ internal static extern JsErrorCode JsRunSerializedScript ( string script , byte [ ] buffer ,
32
+ JsSourceContext sourceContext , string sourceUrl , out EdgeJsValue result ) ;
33
+
34
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
35
+ internal static extern JsErrorCode JsGetPropertyIdFromName ( string name , out EdgeJsPropertyId propertyId ) ;
36
+
37
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
38
+ internal static extern JsErrorCode JsGetPropertyNameFromId ( EdgeJsPropertyId propertyId , out IntPtr buffer ) ;
39
+
40
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
41
+ internal static extern JsErrorCode JsPointerToString ( string value , UIntPtr stringLength ,
42
+ out EdgeJsValue stringValue ) ;
43
+
44
+ [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
45
+ internal static extern JsErrorCode JsStringToPointer ( EdgeJsValue value , out IntPtr stringValue ,
46
+ out UIntPtr stringLength ) ;
47
+
48
+ #endregion
49
+
13
50
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
14
- internal static extern JsErrorCode JsCreateRuntime ( JsRuntimeAttributes attributes , JsThreadServiceCallback threadService , out EdgeJsRuntime runtime ) ;
51
+ internal static extern JsErrorCode JsCreateRuntime ( JsRuntimeAttributes attributes ,
52
+ JsThreadServiceCallback threadService , out EdgeJsRuntime runtime ) ;
15
53
16
54
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
17
55
internal static extern JsErrorCode JsCollectGarbage ( EdgeJsRuntime handle ) ;
@@ -29,10 +67,12 @@ internal static class EdgeNativeMethods
29
67
internal static extern JsErrorCode JsSetRuntimeMemoryLimit ( EdgeJsRuntime runtime , UIntPtr memoryLimit ) ;
30
68
31
69
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
32
- internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback ( EdgeJsRuntime runtime , IntPtr callbackState , JsMemoryAllocationCallback allocationCallback ) ;
70
+ internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback ( EdgeJsRuntime runtime ,
71
+ IntPtr callbackState , JsMemoryAllocationCallback allocationCallback ) ;
33
72
34
73
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
35
- internal static extern JsErrorCode JsSetRuntimeBeforeCollectCallback ( EdgeJsRuntime runtime , IntPtr callbackState , JsBeforeCollectCallback beforeCollectCallback ) ;
74
+ internal static extern JsErrorCode JsSetRuntimeBeforeCollectCallback ( EdgeJsRuntime runtime ,
75
+ IntPtr callbackState , JsBeforeCollectCallback beforeCollectCallback ) ;
36
76
37
77
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode , EntryPoint = "JsAddRef" ) ]
38
78
internal static extern JsErrorCode JsContextAddRef ( EdgeJsContext reference , out uint count ) ;
@@ -64,27 +104,6 @@ internal static class EdgeNativeMethods
64
104
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
65
105
internal static extern JsErrorCode JsIdle ( out uint nextIdleTick ) ;
66
106
67
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
68
- internal static extern JsErrorCode JsParseScript ( string script , JsSourceContext sourceContext , string sourceUrl , out EdgeJsValue result ) ;
69
-
70
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
71
- internal static extern JsErrorCode JsRunScript ( string script , JsSourceContext sourceContext , string sourceUrl , out EdgeJsValue result ) ;
72
-
73
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
74
- internal static extern JsErrorCode JsSerializeScript ( string script , byte [ ] buffer , ref ulong bufferSize ) ;
75
-
76
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
77
- internal static extern JsErrorCode JsParseSerializedScript ( string script , byte [ ] buffer , JsSourceContext sourceContext , string sourceUrl , out EdgeJsValue result ) ;
78
-
79
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
80
- internal static extern JsErrorCode JsRunSerializedScript ( string script , byte [ ] buffer , JsSourceContext sourceContext , string sourceUrl , out EdgeJsValue result ) ;
81
-
82
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
83
- internal static extern JsErrorCode JsGetPropertyIdFromName ( string name , out EdgeJsPropertyId propertyId ) ;
84
-
85
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
86
- internal static extern JsErrorCode JsGetPropertyNameFromId ( EdgeJsPropertyId propertyId , out IntPtr buffer ) ;
87
-
88
107
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
89
108
internal static extern JsErrorCode JsGetUndefinedValue ( out EdgeJsValue undefinedValue ) ;
90
109
@@ -119,26 +138,25 @@ internal static class EdgeNativeMethods
119
138
internal static extern JsErrorCode JsNumberToDouble ( EdgeJsValue value , out double doubleValue ) ;
120
139
121
140
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
122
- internal static extern JsErrorCode JsConvertValueToNumber ( EdgeJsValue value , out EdgeJsValue numberValue ) ;
141
+ internal static extern JsErrorCode JsNumberToInt ( EdgeJsValue value , out int intValue ) ;
123
142
124
143
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
125
- internal static extern JsErrorCode JsGetStringLength ( EdgeJsValue sringValue , out int length ) ;
126
-
127
- [ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
128
- internal static extern JsErrorCode JsPointerToString ( string value , UIntPtr stringLength , out EdgeJsValue stringValue ) ;
144
+ internal static extern JsErrorCode JsConvertValueToNumber ( EdgeJsValue value , out EdgeJsValue numberValue ) ;
129
145
130
146
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
131
- internal static extern JsErrorCode JsStringToPointer ( EdgeJsValue value , out IntPtr stringValue , out UIntPtr stringLength ) ;
147
+ internal static extern JsErrorCode JsGetStringLength ( EdgeJsValue sringValue , out int length ) ;
132
148
133
149
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
134
150
internal static extern JsErrorCode JsConvertValueToString ( EdgeJsValue value , out EdgeJsValue stringValue ) ;
135
151
#if ! NETSTANDARD1_3
136
152
137
153
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
138
- internal static extern JsErrorCode JsVariantToValue ( [ MarshalAs ( UnmanagedType . Struct ) ] ref object var , out EdgeJsValue value ) ;
154
+ internal static extern JsErrorCode JsVariantToValue ( [ MarshalAs ( UnmanagedType . Struct ) ] ref object var ,
155
+ out EdgeJsValue value ) ;
139
156
140
157
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
141
- internal static extern JsErrorCode JsValueToVariant ( EdgeJsValue obj , [ MarshalAs ( UnmanagedType . Struct ) ] out object var ) ;
158
+ internal static extern JsErrorCode JsValueToVariant ( EdgeJsValue obj ,
159
+ [ MarshalAs ( UnmanagedType . Struct ) ] out object var ) ;
142
160
#endif
143
161
144
162
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
@@ -148,7 +166,8 @@ internal static class EdgeNativeMethods
148
166
internal static extern JsErrorCode JsCreateObject ( out EdgeJsValue obj ) ;
149
167
150
168
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
151
- internal static extern JsErrorCode JsCreateExternalObject ( IntPtr data , JsObjectFinalizeCallback finalizeCallback , out EdgeJsValue obj ) ;
169
+ internal static extern JsErrorCode JsCreateExternalObject ( IntPtr data ,
170
+ JsObjectFinalizeCallback finalizeCallback , out EdgeJsValue obj ) ;
152
171
153
172
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
154
173
internal static extern JsErrorCode JsConvertValueToObject ( EdgeJsValue value , out EdgeJsValue obj ) ;
@@ -166,34 +185,42 @@ internal static class EdgeNativeMethods
166
185
internal static extern JsErrorCode JsPreventExtension ( EdgeJsValue obj ) ;
167
186
168
187
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
169
- internal static extern JsErrorCode JsGetProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId , out EdgeJsValue value ) ;
188
+ internal static extern JsErrorCode JsGetProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId ,
189
+ out EdgeJsValue value ) ;
170
190
171
191
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
172
- internal static extern JsErrorCode JsGetOwnPropertyDescriptor ( EdgeJsValue obj , EdgeJsPropertyId propertyId , out EdgeJsValue propertyDescriptor ) ;
192
+ internal static extern JsErrorCode JsGetOwnPropertyDescriptor ( EdgeJsValue obj , EdgeJsPropertyId propertyId ,
193
+ out EdgeJsValue propertyDescriptor ) ;
173
194
174
195
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
175
196
internal static extern JsErrorCode JsGetOwnPropertyNames ( EdgeJsValue obj , out EdgeJsValue propertyNames ) ;
176
197
177
198
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
178
- internal static extern JsErrorCode JsSetProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId , EdgeJsValue value , bool useStrictRules ) ;
199
+ internal static extern JsErrorCode JsSetProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId ,
200
+ EdgeJsValue value , bool useStrictRules ) ;
179
201
180
202
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
181
- internal static extern JsErrorCode JsHasProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId , out bool hasProperty ) ;
203
+ internal static extern JsErrorCode JsHasProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId ,
204
+ out bool hasProperty ) ;
182
205
183
206
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
184
- internal static extern JsErrorCode JsDeleteProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId , bool useStrictRules , out EdgeJsValue result ) ;
207
+ internal static extern JsErrorCode JsDeleteProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId ,
208
+ bool useStrictRules , out EdgeJsValue result ) ;
185
209
186
210
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
187
- internal static extern JsErrorCode JsDefineProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId , EdgeJsValue propertyDescriptor , out bool result ) ;
211
+ internal static extern JsErrorCode JsDefineProperty ( EdgeJsValue obj , EdgeJsPropertyId propertyId ,
212
+ EdgeJsValue propertyDescriptor , out bool result ) ;
188
213
189
214
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
190
215
internal static extern JsErrorCode JsHasIndexedProperty ( EdgeJsValue obj , EdgeJsValue index , out bool result ) ;
191
216
192
217
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
193
- internal static extern JsErrorCode JsGetIndexedProperty ( EdgeJsValue obj , EdgeJsValue index , out EdgeJsValue result ) ;
218
+ internal static extern JsErrorCode JsGetIndexedProperty ( EdgeJsValue obj , EdgeJsValue index ,
219
+ out EdgeJsValue result ) ;
194
220
195
221
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
196
- internal static extern JsErrorCode JsSetIndexedProperty ( EdgeJsValue obj , EdgeJsValue index , EdgeJsValue value ) ;
222
+ internal static extern JsErrorCode JsSetIndexedProperty ( EdgeJsValue obj , EdgeJsValue index ,
223
+ EdgeJsValue value ) ;
197
224
198
225
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
199
226
internal static extern JsErrorCode JsDeleteIndexedProperty ( EdgeJsValue obj , EdgeJsValue index ) ;
@@ -217,13 +244,16 @@ internal static class EdgeNativeMethods
217
244
internal static extern JsErrorCode JsCreateArray ( uint length , out EdgeJsValue result ) ;
218
245
219
246
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
220
- internal static extern JsErrorCode JsCallFunction ( EdgeJsValue function , EdgeJsValue [ ] arguments , ushort argumentCount , out EdgeJsValue result ) ;
247
+ internal static extern JsErrorCode JsCallFunction ( EdgeJsValue function , EdgeJsValue [ ] arguments ,
248
+ ushort argumentCount , out EdgeJsValue result ) ;
221
249
222
250
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
223
- internal static extern JsErrorCode JsConstructObject ( EdgeJsValue function , EdgeJsValue [ ] arguments , ushort argumentCount , out EdgeJsValue result ) ;
251
+ internal static extern JsErrorCode JsConstructObject ( EdgeJsValue function , EdgeJsValue [ ] arguments ,
252
+ ushort argumentCount , out EdgeJsValue result ) ;
224
253
225
254
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
226
- internal static extern JsErrorCode JsCreateFunction ( EdgeJsNativeFunction nativeFunction , IntPtr externalData , out EdgeJsValue function ) ;
255
+ internal static extern JsErrorCode JsCreateFunction ( EdgeJsNativeFunction nativeFunction ,
256
+ IntPtr externalData , out EdgeJsValue function ) ;
227
257
228
258
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
229
259
internal static extern JsErrorCode JsCreateError ( EdgeJsValue message , out EdgeJsValue error ) ;
@@ -262,7 +292,8 @@ internal static class EdgeNativeMethods
262
292
internal static extern JsErrorCode JsIsRuntimeExecutionDisabled ( EdgeJsRuntime runtime , out bool isDisabled ) ;
263
293
264
294
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
265
- internal static extern JsErrorCode JsStartProfiling ( IActiveScriptProfilerCallback callback , ProfilerEventMask eventMask , int context ) ;
295
+ internal static extern JsErrorCode JsStartProfiling ( IActiveScriptProfilerCallback callback ,
296
+ ProfilerEventMask eventMask , int context ) ;
266
297
267
298
[ DllImport ( DllName . Chakra , CharSet = CharSet . Unicode ) ]
268
299
internal static extern JsErrorCode JsStopProfiling ( int reason ) ;
0 commit comments