Sha256: d395b2eed9b9123ae2f4b0bd99aa5daaaa6d7fb5b9fa1dd3cee6aeb2ca48b12a

Contents?: true

Size: 1006 Bytes

Versions: 37

Compression:

Stored size: 1006 Bytes

Contents

#include "rr.h"

namespace rr {

void External::Init() {
  ClassBuilder("External", "Value").
    defineSingletonMethod("New", &New).
    defineMethod("Value", &Value).
    store(&Class);
}
VALUE External::New(VALUE self, VALUE data) {
  return External(wrap(data));
}

v8::Handle<v8::External> External::wrap(VALUE data) {
  Data* holder = new Data(data);
  v8::Local<v8::External> ext = v8::External::New(holder);
  v8::Persistent<v8::External>::New(ext).MakeWeak(holder, &release);
  return ext;
}

VALUE External::unwrap(v8::Handle<v8::External> external) {
  Data* data = (Data*)(external->Value());
  return data->value;
}

VALUE External::Value(VALUE self) {
  return unwrap(External(self));
}

void External::release(v8::Persistent<v8::Value> handle, void* parameter) {
  handle.Dispose();
  Data* data = (Data*)parameter;
  delete data;
}
External::Data::Data(VALUE data) {
  this->value = data;
  rb_gc_register_address(&value);
}
External::Data::~Data() {
  rb_gc_unregister_address(&value);
}
}

Version data entries

37 entries across 37 versions & 8 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/ext/v8/external.cc
therubyracer-0.12.3 ext/v8/external.cc
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/ext/v8/external.cc
therubyracer-xcode-0.12.3 ext/v8/external.cc
therubyracer-xcode-0.12.2 ext/v8/external.cc
therubyracer-tmpfork-0.12.2 ext/v8/external.cc
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/ext/v8/external.cc
therubyracer-0.12.2 ext/v8/external.cc
therubyracer-0.12.1 ext/v8/external.cc
therubyracer-discourse-0.12.0 ext/v8/external.cc
therubyracer-0.12.0 ext/v8/external.cc
therubyracer-0.11.4 ext/v8/external.cc
therubyracer-0.11.3 ext/v8/external.cc
therubyracer-0.11.2 ext/v8/external.cc
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/ext/v8/external.cc
therubyracer-0.11.1 ext/v8/external.cc
therubyracer-0.11.1beta1 ext/v8/external.cc
therubyracer-0.11.0 ext/v8/external.cc
therubyracer-0.11.0beta8-x86-freebsd-9 ext/v8/external.cc
therubyracer-0.11.0beta8-x86_64-linux ext/v8/external.cc