mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
remove old V8_Ref_Create() function
This commit is contained in:
parent
b8b9d69f27
commit
ff0e11fee8
8 changed files with 14 additions and 18 deletions
|
@ -24,7 +24,7 @@ namespace {
|
|||
length = INT2FIX(0);
|
||||
}
|
||||
HandleScope scope;
|
||||
return V8_Ref_Create(self, Array::New(NUM2INT(length)));
|
||||
return rr_v8_ref_create(self, Array::New(NUM2INT(length)));
|
||||
}
|
||||
|
||||
VALUE Length(VALUE self) {
|
||||
|
|
|
@ -62,5 +62,5 @@ void rr_init_func() {
|
|||
|
||||
VALUE rr_reflect_v8_function(Handle<Value> value) {
|
||||
Local<Function> function(Function::Cast(*value));
|
||||
return V8_Ref_Create(FunctionClass, function);
|
||||
return rr_v8_ref_create(FunctionClass, function);
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
VALUE New(VALUE clazz) {
|
||||
VALUE New(VALUE rbclass) {
|
||||
HandleScope handles;
|
||||
if (!Context::InContext()) {
|
||||
rb_raise(rb_eScriptError, "Object::New() called without an entered Context");
|
||||
return Qnil;
|
||||
}
|
||||
return V8_Ref_Create(clazz, Object::New());
|
||||
return rr_v8_ref_create(rbclass, Object::New());
|
||||
}
|
||||
|
||||
VALUE Set(VALUE self, VALUE key, VALUE value) {
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
#include "stdio.h"
|
||||
using namespace v8;
|
||||
|
||||
v8_ref::v8_ref(Handle<void> object, VALUE ref) : handle(Persistent<void>::New(object)) {
|
||||
v8_ref::v8_ref(Handle<void> object) : handle(Persistent<void>::New(object)) {
|
||||
this->references = rb_hash_new();
|
||||
this->set("default", ref);
|
||||
}
|
||||
|
||||
v8_ref::~v8_ref() {
|
||||
|
@ -27,10 +26,6 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
VALUE V8_Ref_Create(VALUE ruby_class, v8::Handle<void> handle, VALUE ref) {
|
||||
return Data_Wrap_Struct(ruby_class, gc_mark, gc_free, new v8_ref(handle, ref));
|
||||
}
|
||||
|
||||
VALUE rr_v8_ref_create(VALUE rbclass, v8::Handle<void> handle) {
|
||||
return Data_Wrap_Struct(rbclass, gc_mark, gc_free, new v8_ref(handle));
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
struct v8_ref {
|
||||
//takes a handle object and adds a new persistent handle for
|
||||
//the referenced object
|
||||
v8_ref(v8::Handle<void> object, VALUE ref = 0);
|
||||
v8_ref(v8::Handle<void> object);
|
||||
virtual ~v8_ref();
|
||||
void set(const char *name, VALUE ref);
|
||||
v8::Persistent<void> handle;
|
||||
|
@ -17,7 +17,6 @@ struct v8_ref {
|
|||
};
|
||||
|
||||
void rr_v8_ref_setref(VALUE handle, const char *name, VALUE ref);
|
||||
VALUE V8_Ref_Create(VALUE ruby_class, v8::Handle<void> handle, VALUE ref = 0);
|
||||
VALUE rr_v8_ref_create(VALUE rbclass, v8::Handle<void> handle);
|
||||
|
||||
template <class T> v8::Local<T> V8_Ref_Get(VALUE object) {
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace {
|
|||
VALUE New(VALUE klazz, VALUE data) {
|
||||
HandleScope handles;
|
||||
VALUE str = rb_funcall(data, rb_intern("to_s"), 0);
|
||||
return V8_Ref_Create(StringClass, String::New(RSTRING_PTR(str), RSTRING_LEN(str)));
|
||||
return rr_v8_ref_create(StringClass, String::New(RSTRING_PTR(str), RSTRING_LEN(str)));
|
||||
}
|
||||
VALUE Utf8Value(VALUE self) {
|
||||
HandleScope handles;
|
||||
|
@ -34,7 +34,7 @@ namespace {
|
|||
VALUE rr_reflect_v8_string(Handle<Value> value) {
|
||||
HandleScope handles;
|
||||
Local<String> string = String::Cast(*value);
|
||||
return V8_Ref_Create(StringClass, string);
|
||||
return rr_v8_ref_create(StringClass, string);
|
||||
}
|
||||
|
||||
void rr_init_str() {
|
||||
|
|
|
@ -104,9 +104,9 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
VALUE New(VALUE clazz) {
|
||||
VALUE New(VALUE rbclass) {
|
||||
HandleScope handles;
|
||||
return V8_Ref_Create(clazz, ObjectTemplate::New());
|
||||
return rr_v8_ref_create(rbclass, ObjectTemplate::New());
|
||||
}
|
||||
VALUE NewInstance(VALUE self) {
|
||||
HandleScope scope;
|
||||
|
@ -163,7 +163,9 @@ namespace {
|
|||
return Qnil;
|
||||
}
|
||||
Local<FunctionTemplate> templ = FunctionTemplate::New(RubyInvocationCallback, rr_v8_external_create(code));
|
||||
return V8_Ref_Create(function_template,templ,code);
|
||||
VALUE ref = rr_v8_ref_create(function_template,templ);
|
||||
rr_v8_ref_setref(ref, "code", code);
|
||||
return ref;
|
||||
}
|
||||
VALUE GetFunction(VALUE self) {
|
||||
HandleScope handles;
|
||||
|
|
|
@ -163,5 +163,5 @@ void rr_init_value() {
|
|||
}
|
||||
|
||||
VALUE rr_wrap_v8_value(Handle<Value>& value) {
|
||||
return V8_Ref_Create(rr_cV8_C_Value, value);
|
||||
return rr_v8_ref_create(rr_cV8_C_Value, value);
|
||||
}
|
Loading…
Add table
Reference in a new issue