1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/context.cc
2012-05-09 14:46:06 -05:00

29 lines
556 B
C++

#include "rr.h"
namespace rr {
void Context::Init() {
ClassBuilder("Context").
defineSingletonMethod("New", &New).
defineMethod("Enter", &Enter).
defineMethod("Exit", &Exit);
}
VALUE Context::New(VALUE ContextClass) {
v8::Persistent<v8::Context> context = v8::Context::New();
Ref<v8::Context> ref = Context::create(context, ContextClass);
context.Dispose();
return ref;
}
VALUE Context::Enter(VALUE self) {
Context(self)->Enter();
return Qnil;
}
VALUE Context::Exit(VALUE self) {
Context(self)->Exit();
return Qnil;
}
}