private static Runtime CreateNewRuntime(IBridge bridge, bool allowCallbacks, bool enableLogging) { // Assume s_mutex is held var runtime = new Runtime(database, bridge, allowCallbacks, enableLogging); allRuntimes.Add(runtime); return runtime; }
public static Runtime InitializeUniqueRuntime(IBridge bridge, bool allowCallbacks, bool enableLogging) { lock (mutex) { if (runtimeStack != null) throw new InvalidOperationException("already initialized for multiple runtimes"); defaultRuntime = CreateNewRuntime(bridge, allowCallbacks, enableLogging); return defaultRuntime; } }
public static void PushRuntime(Runtime runtime) { lock (mutex) { if (defaultRuntime != null && runtime != defaultRuntime) throw new InvalidOperationException("initialized to expect only one runtime"); if (defaultRuntime == null) { if (runtimeStack == null) runtimeStack = new Stack<Runtime>(); runtimeStack.Push(runtime); } } }
public CapturedLogException(Runtime runtime) { Log = runtime.CurrentLog; }
public NullableInteropOps(Runtime outer, Type type, TypeInfo typeInfo) : base(outer, type, typeInfo) { var elemType = TypeInfo.ExplodeNullableType(type); if (elemType == null) throw new InvalidOperationException("not a nullable type"); elemInteropOps = outer.FindInteropOps(elemType); }
public InteropOps(Runtime outer, Type type, TypeInfo typeInfo) { this.outer = outer; this.type = type; var n = typeInfo.RootTypeSteps; rootType = type; while (n-- > 0) rootType = rootType.BaseType; this.typeInfo = typeInfo; }
public ProxiedInteropOps(Runtime outer, Type type, TypeInfo typeInfo) : base(outer, type, typeInfo) { }
public NormalReferenceInteropOps(Runtime outer, Type type, TypeInfo typeInfo) : base(outer, type, typeInfo) { }
public StringInteropOps(Runtime outer, Type type, TypeInfo typeInfo) : base(outer, type, typeInfo) { }
public NumberInteropOps(Runtime outer, Type type, TypeInfo typeInfo) : base(outer, type, typeInfo) { }
public DelegateInteropOps(Runtime outer, Type type, TypeInfo typeInfo) : base(outer, type, typeInfo) { var resType = default(Type); var argTypes = TypeInfo.ExplodeDelegateType(type, out resType); if (argTypes == null) throw new InvalidOperationException("not a delegate type"); argInteropOps = new InteropOps[argTypes.Count]; for (var i = 0; i < argTypes.Count; i++) argInteropOps[i] = outer.FindInteropOps(argTypes[i]); resInteropOps = resType == null ? null : outer.FindInteropOps(resType); captureThis = typeInfo.CaptureThis; inlineParamsArray = typeInfo.InlineParamsArray; }
public InteropContext(Runtime runtime) { InteropContextManager.PushRuntime(runtime); }
public void PrepareNewRuntime(Runtime runtime) { foreach (var sei in staticExports) runtime.BindExportedMethod(sei.MethodBase, null, sei.Script); }