1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

Make the V8 Context native wrapper more private.

This commit is contained in:
Charles Lowell 2010-06-07 10:13:26 +03:00
parent 0ffd0c6bf8
commit f8fc3a3284
5 changed files with 13 additions and 34 deletions

View file

@ -62,9 +62,6 @@ VALUE rr_v82rb(Handle<Value> value) {
return rr_wrap_v8_value(value);
}
VALUE rr_v82rb(Handle<Context> value) {
return rr_reflect_v8_context(value);
}
VALUE rr_v82rb(Handle<Message> value) {
return rr_reflect_v8_message(value);
}

View file

@ -19,7 +19,6 @@ VALUE rr_v82rb(v8::Handle<v8::Function> value);
VALUE rr_v82rb(v8::Handle<v8::Integer> value);
VALUE rr_v82rb(v8::Handle<v8::Uint32> value);
VALUE rr_v82rb(v8::Handle<v8::Int32> value);
VALUE rr_v82rb(v8::Handle<v8::Context> value);
VALUE rr_v82rb(v8::Handle<v8::Message> value);
VALUE rr_v82rb(bool value);
VALUE rr_v82rb(double value);

View file

@ -46,11 +46,5 @@ void rr_init_v8_array() {
VALUE rr_reflect_v8_array(Handle<Value> value) {
Local<Array> array(Array::Cast(*value));
Local<Value> peer = array->GetHiddenValue(String::New("TheRubyRacer::RubyObject"));
if (peer.IsEmpty()) {
VALUE arr = V8_Ref_Create(ArrayClass, array);
rb_iv_set(arr, "@context", rr_v82rb(Context::GetEntered()));
return arr;
} else {
return (VALUE)External::Unwrap(peer);
}
return peer.IsEmpty() ? rr_v8_ref_create(ArrayClass, value) : (VALUE)External::Unwrap(peer);
}

View file

@ -1,4 +1,5 @@
#include "rr.h"
#include "v8_ref.h"
#include "v8_cxt.h"
#include "v8_msg.h"
#include "v8_template.h"
@ -6,10 +7,10 @@
using namespace v8;
VALUE V8_C_Context;
namespace {
VALUE ContextClass;
Local<Context> unwrap(VALUE value) {
return V8_Ref_Get<Context>(value);
}
@ -21,7 +22,7 @@ namespace {
Handle<ObjectTemplate> v8_global_template(NIL_P(global_template) ? Handle<ObjectTemplate>() : V8_Ref_Get<ObjectTemplate>(global_template));
Handle<Value> v8_global_object(NIL_P(global_object) ? Handle<Value>() : V8_Ref_Get<Value>(global_object));
Persistent<Context> cxt(Context::New(0, v8_global_template, v8_global_object));
VALUE ref = V8_Ref_Create(self, cxt);
VALUE ref = rr_v8_ref_create(self, cxt);
cxt.Dispose();
return ref;
}
@ -34,7 +35,7 @@ namespace {
HandleScope handles;
if (Context::InContext()) {
Local<Context> current = Context::GetEntered();
return V8_Ref_Create(self, current);
return rr_v8_ref_create(self, current);
} else {
return Qnil;
}
@ -68,7 +69,7 @@ namespace {
}
void rr_init_cxt() {
VALUE ContextClass = V8_C_Context = rr_define_class("Context");
ContextClass = rr_define_class("Context");
rr_define_singleton_method(ContextClass, "New", New, -1);
rr_define_singleton_method(ContextClass, "InContext", InContext, 0);
rr_define_singleton_method(ContextClass, "GetEntered", GetEntered, 0);
@ -78,8 +79,3 @@ void rr_init_cxt() {
rr_define_method(ContextClass, "IsEntered", IsEntered, 0);
}
VALUE rr_reflect_v8_context(Handle<Context> value) {
return V8_Ref_Create(V8_C_Context, value);
}

View file

@ -1,13 +1,6 @@
#ifndef _RUBY_V8_CXT_
#define _RUBY_V8_CXT_
#include "ruby.h"
#include "v8.h"
#include "v8_ref.h"
extern VALUE V8_C_Context;
void rr_init_cxt();
VALUE rr_reflect_v8_context(v8::Handle<v8::Context> value);
#endif