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