Sha256: 7c257ef63632690a928e3acb1926fe829ee300c74fb5fae20429cf61880e133b

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

# typed: ignore

# Copyright (c) 2015 Sqreen. All Rights Reserved.
# Please refer to our terms for more information: https://www.sqreen.com/terms.html

# TODO: => Sqreen::JS:MiniRacer

require 'digest'
require 'json'
require 'sqreen/js/executable_js'
require 'sqreen/js/js_service_adapter'
require 'sqreen/js/context_pool'
require 'sqreen/js/mini_racer_executable_js'

module Sqreen
  module Js
    DEFAULT_GC_THRESHOLD = 15000000  # 15 MB

    class MiniRacerAdapter < JsServiceAdapter
      def initialize(vendored = false)
        @vendored = vendored
        @pool = ContextPool.new
        self.class.static_init
      end

      def preprocess(rule_name, code)
        Sqreen.log.debug("js:#{self.class.name} variant:#{variant_name} preprocess:#{rule_name}")
        MiniRacerExecutableJs.new(@pool, code, @vendored)
      end

      def variant_name
        @vendored ? 'sq_mini_racer' : 'mini_racer'
      end

      def self.static_init
        return if @done_static_init
        Sqreen::MiniRacer::Platform.set_flags! :noconcurrent_recompilation
        @done_static_init = true
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sqreen-1.24.3 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.24.2 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.24.1 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.24.0 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.23.2 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.23.1 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.23.0 lib/sqreen/js/mini_racer_adapter.rb
sqreen-1.22.1 lib/sqreen/js/mini_racer_adapter.rb