sqreen 1.10.2-java → 1.10.3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2277eaa2d49d4308c33a920b5faf831445067e4bce6e46a745211c511f59e318
4
- data.tar.gz: 510b43dd0c0b70cec0c6423bb7090321e7f64ffdd8189d7fc799d6f0ed6d0ad3
3
+ metadata.gz: c91d7e3b39f5bfa453736517993a2f82e09c517ca64d4193a854d31c590732ba
4
+ data.tar.gz: 9fdc5c95877b79971bd834555ef4e899ba14b9675a93dd20f812b088782b4654
5
5
  SHA512:
6
- metadata.gz: 344b5bb85b8d5c5b1d42c46bb853e2b3163450a513c0c05c27dac4141c0c621678a550722e20528d8e40de4a1e76b97e378ca426cfd7dd655e102c57fddeb200
7
- data.tar.gz: 1f1de62a20ce2e3afc39969ef53459b9b5b8a25ef9ceb4fc7d88c947bc424693d1d75dea9ed4c02fbf234afe7dde54639a850f2b8bdb91df2f0eb3bc0f17a9ca
6
+ metadata.gz: aeab43c7f9cdd3aab746f49ce1b35d5b9cc1cb09da7bafef45ce9ade183e0c4c576533ae9088308de8695006eeda5aabb5114b34f96922dda4f69d610d0446be
7
+ data.tar.gz: 4a894580f1ed880ecf7760483709ee811a3f86ff3fd2b9c7eea5392c45737c78bccb003b37c4ad72ec68394052485c78425557677e7e6c22fbea599e53690c4e
@@ -147,23 +147,35 @@ module Sqreen
147
147
  end
148
148
  end
149
149
 
150
+ def push_runtime(runtime)
151
+ @runtimes.delete_if do |th, _runt|
152
+ th.nil? || !th.weakref_alive? || !th.alive?
153
+ end
154
+ @runtimes.push [WeakRef.new(Thread.current), runtime, Thread.current.object_id]
155
+ end
156
+
157
+ def dispose_runtime(runtime)
158
+ @runtimes.delete_if { |_th, _runt, thid| thid == Thread.current.object_id }
159
+ runtime.dispose
160
+ end
161
+
150
162
  def call_callback(name, inst, args, rv = nil)
151
163
  if SQREEN_MINI_RACER
152
- mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{self.object_id}"]
164
+ mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"]
153
165
  if mini_racer_context.nil? || mini_racer_context[:r].nil? || !mini_racer_context[:r].weakref_alive?
154
- runtime = MiniRacer::Context.new(snapshot: @snapshot)
155
- @runtimes.push runtime
156
- Thread.current["SQREEN_MINI_RACER_CONTEXT_#{self.object_id}"] = {:c => 0, :r => WeakRef.new(runtime)}
166
+ new_runtime = MiniRacer::Context.new(:snapshot => @snapshot)
167
+ push_runtime new_runtime
168
+ Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"] = {
169
+ :c => 0,
170
+ :r => WeakRef.new(new_runtime),
171
+ }
157
172
  elsif mini_racer_context[:c] >= GC_MINI_RACER
158
- @runtimes.delete(mini_racer_context[:r])
159
- mini_racer_context[:r].dispose
160
-
161
- new_runtime = MiniRacer::Context.new(snapshot: @snapshot)
162
- @runtimes.push new_runtime
163
-
164
- Thread.current["SQREEN_MINI_RACER_CONTEXT_#{self.object_id}"] = {
173
+ dispose_runtime(mini_racer_context[:r])
174
+ new_runtime = MiniRacer::Context.new(:snapshot => @snapshot)
175
+ push_runtime new_runtime
176
+ Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"] = {
165
177
  :c => 0,
166
- :r => WeakRef.new(new_runtime)
178
+ :r => WeakRef.new(new_runtime),
167
179
  }
168
180
  end
169
181
  end
@@ -177,7 +189,7 @@ module Sqreen
177
189
  arguments = restrict(name, arguments) if @conditions.key?(name)
178
190
  Sqreen.log.debug { [name, arguments].inspect }
179
191
  if SQREEN_MINI_RACER
180
- mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{self.object_id}"]
192
+ mini_racer_context = Thread.current["SQREEN_MINI_RACER_CONTEXT_#{object_id}"]
181
193
  mini_racer_context[:c] += 1
182
194
  ret = mini_racer_context[:r].eval("#{name}.apply(this, #{::JSON.generate(arguments)})")
183
195
  else
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
  module Sqreen
4
- VERSION = '1.10.2'.freeze
4
+ VERSION = '1.10.3'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.10.3
5
5
  platform: java
6
6
  authors:
7
7
  - Sqreen