Exemplo n.º 1
0
        public JsContext CreateContext(JsTypeDefinitionBuilder customTypeDefBuilder)
        {
            CheckDisposed();
            int id = Interlocked.Increment(ref _currentContextId);

            JsContext ctx = new JsContext(id, this, _engine, ContextDisposed, customTypeDefBuilder);

            _aliveContexts.Add(id, ctx);
            return(ctx);
        }
Exemplo n.º 2
0
        public JsEngine(JsTypeDefinitionBuilder defaultTypeBuilder, int maxYoungSpace, int maxOldSpace)
        {
            _keepalive_remove               = new KeepaliveRemoveDelegate(KeepAliveRemove);
            _keepalive_get_property_value   = new KeepAliveGetPropertyValueDelegate(KeepAliveGetPropertyValue);
            _keepalive_set_property_value   = new KeepAliveSetPropertyValueDelegate(KeepAliveSetPropertyValue);
            _keepalive_valueof              = new KeepAliveValueOfDelegate(KeepAliveValueOf);
            _keepalive_invoke               = new KeepAliveInvokeDelegate(KeepAliveInvoke);
            _keepalive_delete_property      = new KeepAliveDeletePropertyDelegate(KeepAliveDeleteProperty);
            _keepalive_enumerate_properties = new KeepAliveEnumeratePropertiesDelegate(KeepAliveEnumerateProperties);

            _engine = new HandleRef(this, jsengine_new(
                                        _keepalive_remove,
                                        _keepalive_get_property_value,
                                        _keepalive_set_property_value,
                                        _keepalive_valueof,
                                        _keepalive_invoke,
                                        _keepalive_delete_property,
                                        _keepalive_enumerate_properties,
                                        maxYoungSpace,
                                        maxOldSpace));
            this.defaultTypeBuilder = defaultTypeBuilder;
        }
Exemplo n.º 3
0
        public JsEngine(JsTypeDefinitionBuilder defaultTypeBuilder, int maxYoungSpace, int maxOldSpace)
        {
            _keepalive_remove = new KeepaliveRemoveDelegate(KeepAliveRemove);
            _keepalive_get_property_value = new KeepAliveGetPropertyValueDelegate(KeepAliveGetPropertyValue);
            _keepalive_set_property_value = new KeepAliveSetPropertyValueDelegate(KeepAliveSetPropertyValue);
            _keepalive_valueof = new KeepAliveValueOfDelegate(KeepAliveValueOf);
            _keepalive_invoke = new KeepAliveInvokeDelegate(KeepAliveInvoke);
            _keepalive_delete_property = new KeepAliveDeletePropertyDelegate(KeepAliveDeleteProperty);
            _keepalive_enumerate_properties = new KeepAliveEnumeratePropertiesDelegate(KeepAliveEnumerateProperties);

            _engine = new HandleRef(this, jsengine_new(
                _keepalive_remove,
                _keepalive_get_property_value,
                _keepalive_set_property_value,
                _keepalive_valueof,
                _keepalive_invoke,
                _keepalive_delete_property,
                _keepalive_enumerate_properties,
                maxYoungSpace,
                maxOldSpace));
            this.defaultTypeBuilder = defaultTypeBuilder;
        }
Exemplo n.º 4
0
        internal JsContext(int id,
                           JsEngine engine,
                           HandleRef engineHandle,
                           Action <int> notifyDispose,
                           JsTypeDefinitionBuilder jsTypeDefBuilder)
        {
            _id            = id;
            _engine        = engine;
            _notifyDispose = notifyDispose;

            _keepalives = new KeepAliveDictionaryStore();
            _context    = new HandleRef(this, jscontext_new(id, engineHandle));
            _convert    = new JsConvert(this);

            this.jsTypeDefBuilder = jsTypeDefBuilder;

            engineMethodCallbackDel = new ManagedMethodCallDel(EngineListener_MethodCall);
            NativeV8JsInterOp.CtxRegisterManagedMethodCall(this, engineMethodCallbackDel);
            registerMethods.Add(null);    //first is null
            registerProperties.Add(null); //first is null


            proxyStore = new NativeObjectProxyStore(this);
        }
Exemplo n.º 5
0
        public JsContext CreateContext(JsTypeDefinitionBuilder customTypeDefBuilder)
        {
            CheckDisposed();
            int id = Interlocked.Increment(ref _currentContextId);

            JsContext ctx = new JsContext(id, this, _engine, ContextDisposed, customTypeDefBuilder);

            _aliveContexts.Add(id, ctx);
            return ctx;
        }