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

30 lines
556 B
C++
Raw Normal View History

#include "rr.h"
namespace rr {
2012-05-01 14:53:01 -04:00
void Context::Init() {
ClassBuilder("Context").
defineSingletonMethod("New", &New).
defineMethod("Enter", &Enter).
defineMethod("Exit", &Exit);
}
2012-05-01 14:53:01 -04:00
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;
}
2012-05-01 14:53:01 -04:00
VALUE Context::Enter(VALUE self) {
Context(self)->Enter();
return Qnil;
}
2012-05-01 14:53:01 -04:00
VALUE Context::Exit(VALUE self) {
Context(self)->Exit();
return Qnil;
}
}