internal void _Initialize(V8Engine v8EngineProxy, NativeFunctionTemplateProxy *nativeFunctionTemplateProxy) { if (v8EngineProxy == null) { throw new ArgumentNullException("v8EngineProxy"); } if (nativeFunctionTemplateProxy == null) { throw new ArgumentNullException("nativeFunctionTemplateProxy"); } _Engine = v8EngineProxy; _NativeFunctionTemplateProxy = nativeFunctionTemplateProxy; InstanceTemplate = new ObjectTemplate(); InstanceTemplate.Parent = this; InstanceTemplate._Initialize(_Engine, V8NetProxy.GetFunctionInstanceTemplateProxy(_NativeFunctionTemplateProxy), false); PrototypeTemplate = new ObjectTemplate(); PrototypeTemplate.Parent = this; PrototypeTemplate._Initialize(_Engine, V8NetProxy.GetFunctionPrototypeTemplateProxy(_NativeFunctionTemplateProxy), false); OnInitialized(); }
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) }