mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-19 21:16:10 -05:00
Upgrade ruby racer so we can remove our freedom patch
This commit is contained in:
parent
2a3f71a9a1
commit
9191fbe9fb
2 changed files with 1 additions and 34 deletions
|
@ -422,7 +422,7 @@ GEM
|
||||||
sprockets (~> 2.8)
|
sprockets (~> 2.8)
|
||||||
stackprof (0.2.7)
|
stackprof (0.2.7)
|
||||||
stringex (2.5.2)
|
stringex (2.5.2)
|
||||||
therubyracer (0.12.1)
|
therubyracer (0.12.2)
|
||||||
libv8 (~> 3.16.14.0)
|
libv8 (~> 3.16.14.0)
|
||||||
ref
|
ref
|
||||||
thin (1.6.3)
|
thin (1.6.3)
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
## TODO: DELETE ME WHEN https://github.com/cowboyd/therubyracer/pull/336
|
|
||||||
# is upstreamed and released
|
|
||||||
#
|
|
||||||
module V8
|
|
||||||
module Weak
|
|
||||||
class WeakValueMap
|
|
||||||
def initialize
|
|
||||||
@values = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
def [](key)
|
|
||||||
if ref = @values[key]
|
|
||||||
ref.object
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def []=(key, value)
|
|
||||||
ref = V8::Weak::Ref.new(value)
|
|
||||||
ObjectSpace.define_finalizer(value, self.class.ensure_cleanup(@values, key, ref))
|
|
||||||
|
|
||||||
@values[key] = ref
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def self.ensure_cleanup(values,key,ref)
|
|
||||||
proc {
|
|
||||||
values.delete(key) if values[key] == ref
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue