Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
        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);
                }
            }
        }
Ejemplo n.º 4
0
 public CapturedLogException(Runtime runtime)
 {
     Log = runtime.CurrentLog;
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 public ProxiedInteropOps(Runtime outer, Type type, TypeInfo typeInfo)
     : base(outer, type, typeInfo)
 {
 }
Ejemplo n.º 8
0
 public NormalReferenceInteropOps(Runtime outer, Type type, TypeInfo typeInfo)
     : base(outer, type, typeInfo)
 {
 }
Ejemplo n.º 9
0
 public StringInteropOps(Runtime outer, Type type, TypeInfo typeInfo)
     : base(outer, type, typeInfo)
 {
 }
Ejemplo n.º 10
0
 public NumberInteropOps(Runtime outer, Type type, TypeInfo typeInfo)
     : base(outer, type, typeInfo)
 {
 }
Ejemplo n.º 11
0
 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;
 }
Ejemplo n.º 12
0
 public InteropContext(Runtime runtime)
 {
     InteropContextManager.PushRuntime(runtime);
 }
Ejemplo n.º 13
0
 public void PrepareNewRuntime(Runtime runtime)
 {
     foreach (var sei in staticExports)
         runtime.BindExportedMethod(sei.MethodBase, null, sei.Script);
 }