Settings of the Vroom JS engine
        /// <summary>
        /// Constructs an instance of adapter for the Vroom JS engine
        /// (cross-platform bridge to the V8 JS engine)
        /// </summary>
        /// <param name="settings">Settings of the Vroom JS engine</param>
        public VroomJsEngine(VroomSettings settings)
        {
            VroomSettings vroomSettings = settings ?? new VroomSettings();

            try
            {
                _jsEngine = new OriginalJsEngine(vroomSettings.MaxYoungSpaceSize,
                                                 vroomSettings.MaxOldSpaceSize);
                _jsContext = _jsEngine.CreateContext();
            }
            catch (Exception e)
            {
                throw new JsEngineLoadException(
                          string.Format(CoreStrings.Runtime_JsEngineNotLoaded,
                                        EngineName, e.Message), EngineName, EngineVersion, e);
            }
        }
		/// <summary>
		/// Adds a instance of <see cref="VroomJsEngineFactory"/> to
		/// the specified <see cref="JsEngineFactoryCollection" />
		/// </summary>
		/// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
		/// <param name="settings">Settings of the Vroom JS engine</param>
		/// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
		public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source,
			VroomSettings settings)
		{
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}

			if (settings == null)
			{
				throw new ArgumentNullException("settings");
			}

			source.Add(new VroomJsEngineFactory(settings));

			return source;
		}
Exemple #3
0
        /// <summary>
        /// Adds a instance of <see cref="VroomJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="settings">Settings of the Vroom JS engine</param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source,
                                                         VroomSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            source.Add(new VroomJsEngineFactory(settings));

            return(source);
        }
		/// <summary>
		/// Adds a instance of <see cref="VroomJsEngineFactory"/> to
		/// the specified <see cref="JsEngineFactoryCollection" />
		/// </summary>
		/// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
		/// <param name="configure">The delegate to configure the provided <see cref="VroomSettings"/></param>
		/// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
		public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source,
			Action<VroomSettings> configure)
		{
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}

			if (configure == null)
			{
				throw new ArgumentNullException("configure");
			}

			var settings = new VroomSettings();
			configure(settings);

			return source.AddVroom(settings);
		}
Exemple #5
0
        /// <summary>
        /// Adds a instance of <see cref="VroomJsEngineFactory"/> to
        /// the specified <see cref="JsEngineFactoryCollection" />
        /// </summary>
        /// <param name="source">Instance of <see cref="JsEngineFactoryCollection" /></param>
        /// <param name="configure">The delegate to configure the provided <see cref="VroomSettings"/></param>
        /// <returns>Instance of <see cref="JsEngineFactoryCollection" /></returns>
        public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source,
                                                         Action <VroomSettings> configure)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var settings = new VroomSettings();

            configure(settings);

            return(source.AddVroom(settings));
        }
        /// <summary>
        /// Constructs an instance of adapter for the Vroom JS engine
        /// (cross-platform bridge to the V8 JS engine)
        /// </summary>
        /// <param name="settings">Settings of the Vroom JS engine</param>
        public VroomJsEngine(VroomSettings settings)
        {
            Initialize();

            VroomSettings vroomSettings = settings ?? new VroomSettings();

            try
            {
                _jsEngine  = new OriginalEngine(vroomSettings.MaxYoungSpaceSize, vroomSettings.MaxOldSpaceSize);
                _jsContext = _jsEngine.CreateContext();
            }
            catch (TypeInitializationException e)
            {
                Exception innerException = e.InnerException;
                if (innerException != null)
                {
                    var dllNotFoundException = innerException as DllNotFoundException;
                    if (dllNotFoundException != null)
                    {
                        throw WrapDllNotFoundException(dllNotFoundException);
                    }
                    else
                    {
                        throw JsErrorHelpers.WrapEngineLoadException(innerException, EngineName, EngineVersion,
                                                                     true);
                    }
                }

                throw JsErrorHelpers.WrapEngineLoadException(e, EngineName, EngineVersion, true);
            }
            catch (Exception e)
            {
                throw JsErrorHelpers.WrapEngineLoadException(e, EngineName, EngineVersion, true);
            }
            finally
            {
                if (_jsContext == null)
                {
                    Dispose();
                }
            }
        }
 /// <summary>
 /// Constructs an instance of the Vroom JS engine factory
 /// </summary>
 /// <param name="settings">Settings of the Vroom JS engine</param>
 public VroomJsEngineFactory(VroomSettings settings)
 {
     _settings = settings;
 }
		/// <summary>
		/// Constructs an instance of the Vroom JS engine factory
		/// </summary>
		/// <param name="settings">Settings of the Vroom JS engine</param>
		public VroomJsEngineFactory(VroomSettings settings)
		{
			_settings = settings;
		}