“IE” Chakra runtime

Each Chakra runtime has its own independent execution engine, JIT compiler, and garbage collected heap. As such, each runtime is completely isolated from other runtimes.

Runtimes can be used on any thread, but only one thread can call into a runtime at any time.

NOTE: A IeJsRuntime, unlike other objects in the Chakra hosting API, is not garbage collected since it contains the garbage collected heap itself. A runtime will continue to exist until Dispose is called.

Ejemplo n.º 1
0
        /// <summary>
        /// Constructs an instance of the Chakra “IE” JsRT JavaScript engine
        /// </summary>
        /// <param name="enableDebugging">Flag for whether to enable script debugging features</param>
        public ChakraIeJsRtJsEngine(bool enableDebugging)
            : base(JsEngineMode.ChakraIeJsRt, enableDebugging)
        {
            _dispatcher.Invoke(() =>
            {
                try
                {
                    _jsRuntime = CreateJsRuntime();
                    _jsContext = _jsRuntime.CreateContext();
                }
                catch (JsUsageException e)
                {
                    string errorMessage;
                    if (e.ErrorCode == JsErrorCode.WrongThread)
                    {
                        errorMessage = CommonStrings.Runtime_JsEnginesConflictOnMachine;
                    }
                    else
                    {
                        errorMessage = string.Format(CommonStrings.Runtime_IeJsEngineNotLoaded,
                                                     _engineModeName, LOWER_IE_VERSION, e.Message);
                    }

                    throw new JsEngineLoadException(errorMessage, _engineModeName);
                }
                catch (Exception e)
                {
                    throw new JsEngineLoadException(
                        string.Format(CommonStrings.Runtime_IeJsEngineNotLoaded,
                                      _engineModeName, LOWER_IE_VERSION, e.Message), _engineModeName);
                }
            });
        }
 internal static extern JsErrorCode JsSetRuntimeBeforeCollectCallback(IeJsRuntime runtime, IntPtr callbackState, JsBeforeCollectCallback beforeCollectCallback);
 internal static extern JsErrorCode JsIsRuntimeExecutionDisabled(IeJsRuntime runtime, out bool isDisabled);
 internal static extern JsErrorCode JsGetRuntimeMemoryUsage(IeJsRuntime runtime, out UIntPtr memoryUsage);
Ejemplo n.º 5
0
 internal static extern JsErrorCode JsEnableRuntimeExecution(IeJsRuntime runtime);
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a instance of JavaScript runtime with special settings
 /// </summary>
 /// <returns>Instance of JavaScript runtime with special settings</returns>
 private static IeJsRuntime CreateJsRuntime()
 {
     return(IeJsRuntime.Create(JsRuntimeAttributes.None, JsRuntimeVersion.VersionEdge, null));
 }
 internal static extern JsErrorCode JsCreateRuntime(JsRuntimeAttributes attributes, JsRuntimeVersion runtimeVersion, JsThreadServiceCallback threadService, out IeJsRuntime runtime);
 internal static extern JsErrorCode JsCollectGarbage(IeJsRuntime handle);
Ejemplo n.º 9
0
 internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback(IeJsRuntime runtime,
                                                                         IntPtr callbackState, JsMemoryAllocationCallback allocationCallback);
Ejemplo n.º 10
0
 internal static extern JsErrorCode JsSetRuntimeMemoryLimit(IeJsRuntime runtime, UIntPtr memoryLimit);
Ejemplo n.º 11
0
 internal static extern JsErrorCode JsGetRuntimeMemoryUsage(IeJsRuntime runtime, out UIntPtr memoryUsage);
Ejemplo n.º 12
0
 internal static extern JsErrorCode JsDisposeRuntime(IeJsRuntime handle);
Ejemplo n.º 13
0
 internal static extern JsErrorCode JsCollectGarbage(IeJsRuntime handle);
Ejemplo n.º 14
0
 internal static extern JsErrorCode JsCreateRuntime(JsRuntimeAttributes attributes,
                                                    JsRuntimeVersion runtimeVersion, JsThreadServiceCallback threadService, out IeJsRuntime runtime);
Ejemplo n.º 15
0
 internal static extern JsErrorCode JsIsRuntimeExecutionDisabled(IeJsRuntime runtime, out bool isDisabled);
 internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback(IeJsRuntime runtime, IntPtr callbackState, JsMemoryAllocationCallback allocationCallback);
 internal static extern JsErrorCode JsSetRuntimeMemoryLimit(IeJsRuntime runtime, UIntPtr memoryLimit);
Ejemplo n.º 18
0
 internal static extern JsErrorCode JsSetRuntimeBeforeCollectCallback(IeJsRuntime runtime,
                                                                      IntPtr callbackState, JsBeforeCollectCallback beforeCollectCallback);
 internal static extern JsErrorCode JsCreateContext(IeJsRuntime runtime, IDebugApplication32 debugSite, out IeJsContext newContext);
Ejemplo n.º 20
0
 internal static extern JsErrorCode JsCreateContext(IeJsRuntime runtime, IDebugApplication32 debugSite,
                                                    out IeJsContext newContext);
 internal static extern JsErrorCode JsDisableRuntimeExecution(IeJsRuntime runtime);
 internal static extern JsErrorCode JsDisposeRuntime(IeJsRuntime handle);
 internal static extern JsErrorCode JsGetRuntime(IeJsContext context, out IeJsRuntime runtime);
Ejemplo n.º 24
0
 internal static extern JsErrorCode JsGetRuntime(IeJsContext context, out IeJsRuntime runtime);