mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
Upgrade ruby racer so we can remove our freedom patch
This commit is contained in:
parent
2a3f71a9a1
commit
9191fbe9fb
@ -422,7 +422,7 @@ GEM
|
||||
sprockets (~> 2.8)
|
||||
stackprof (0.2.7)
|
||||
stringex (2.5.2)
|
||||
therubyracer (0.12.1)
|
||||
therubyracer (0.12.2)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
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 New Issue
Block a user