SetGlobalObjectTemplate() private method

private SetGlobalObjectTemplate ( NativeV8EngineProxy engine, NativeObjectTemplateProxy proxy ) : HandleProxy*
engine NativeV8EngineProxy
proxy NativeObjectTemplateProxy
return HandleProxy*
Esempio n. 1
0
        public V8Engine()
        {
            this.RunMarshallingTests();

            lock (_GlobalLock) // (required because engine proxy instance IDs are tracked on the native side in a static '_DisposedEngines' vector [for quick disposal of handles])
            {
                _NativeV8EngineProxy = V8NetProxy.CreateV8EngineProxy(false, null, 0);

                _RegisterEngine(_NativeV8EngineProxy->ID);

                _GlobalObjectTemplateProxy = CreateObjectTemplate <ObjectTemplate>();
                _GlobalObjectTemplateProxy.UnregisterPropertyInterceptors();                                                                    // (it's much faster to use a native object for the global scope)
                GlobalObject = V8NetProxy.SetGlobalObjectTemplate(_NativeV8EngineProxy, _GlobalObjectTemplateProxy._NativeObjectTemplateProxy); // (returns the global object handle)
            }

            ___V8GarbageCollectionRequestCallback = _V8GarbageCollectionRequestCallback;
            V8NetProxy.RegisterGCCallback(_NativeV8EngineProxy, ___V8GarbageCollectionRequestCallback);

            _Initialize_Handles();
            _Initialize_ObjectTemplate();
            _Initialize_Worker(); // (DO THIS LAST!!! - the worker expects everything to be ready)
        }