示例#1
0
 public JSRuntime(uint maxBytes = 1024 * 1024 * 8)
 {
     Pointer = JSAPI.NewRuntime(maxBytes);
     if (Pointer.IsZero)
     {
         throw new Exception();
     }
 }
示例#2
0
        public JSContext(JSRuntimePtr runtime)
        {
            Runtime = runtime;

            Pointer = JSAPI.NewContext(runtime, 8192);
            if (Pointer.IsZero)
            {
                throw new Exception();
            }

            Exception = new JSContextExceptionStatus(Pointer);
            WeakSelf  = new WeakReference(this, true);

            if (!ContextRegistry.TryAdd(Pointer, WeakSelf))
            {
                throw new Exception("Failed to update context registry");
            }
        }