2012-05-03 13:56:41 -04:00
|
|
|
#include "rr.h"
|
|
|
|
|
|
|
|
namespace rr {
|
2012-05-03 18:21:25 -04:00
|
|
|
|
2012-05-03 13:56:41 -04:00
|
|
|
void V8::Init() {
|
2012-05-03 17:47:23 -04:00
|
|
|
ClassBuilder("V8").
|
2012-05-25 16:53:13 -04:00
|
|
|
defineSingletonMethod("IdleNotification", &IdleNotification).
|
2012-06-08 07:06:49 -04:00
|
|
|
defineSingletonMethod("SetCaptureStackTraceForUncaughtExceptions", &SetCaptureStackTraceForUncaughtExceptions).
|
2012-06-14 04:52:32 -04:00
|
|
|
defineSingletonMethod("GetHeapStatistics", &GetHeapStatistics).
|
|
|
|
defineSingletonMethod("GetVersion", &GetVersion);
|
2012-05-03 13:56:41 -04:00
|
|
|
}
|
2012-05-03 18:21:25 -04:00
|
|
|
|
2012-06-08 03:29:16 -04:00
|
|
|
VALUE V8::IdleNotification(int argc, VALUE argv[], VALUE self) {
|
|
|
|
VALUE hint;
|
|
|
|
rb_scan_args(argc, argv, "01", &hint);
|
|
|
|
if (RTEST(hint)) {
|
|
|
|
return Bool(v8::V8::IdleNotification(NUM2INT(hint)));
|
|
|
|
} else {
|
|
|
|
return Bool(v8::V8::IdleNotification());
|
|
|
|
}
|
2012-05-03 18:21:25 -04:00
|
|
|
}
|
|
|
|
|
2012-05-25 16:53:13 -04:00
|
|
|
VALUE V8::SetCaptureStackTraceForUncaughtExceptions(int argc, VALUE argv[], VALUE self) {
|
|
|
|
VALUE should_capture; VALUE frame_limit; VALUE options;
|
|
|
|
rb_scan_args(argc, argv, "12", &should_capture, &frame_limit, &options);
|
|
|
|
int limit = RTEST(frame_limit) ? NUM2INT(frame_limit) : 10;
|
|
|
|
Void(v8::V8::SetCaptureStackTraceForUncaughtExceptions(Bool(should_capture), limit, Stack::Trace::StackTraceOptions(options)));
|
|
|
|
}
|
|
|
|
|
2012-06-08 07:06:49 -04:00
|
|
|
VALUE V8::GetHeapStatistics(VALUE self, VALUE statistics_ptr) {
|
|
|
|
Void(v8::V8::GetHeapStatistics(HeapStatistics(statistics_ptr)));
|
|
|
|
}
|
|
|
|
|
2012-06-14 04:52:32 -04:00
|
|
|
VALUE V8::GetVersion(VALUE self) {
|
|
|
|
return rb_str_new2(v8::V8::GetVersion());
|
|
|
|
}
|
2012-05-03 13:56:41 -04:00
|
|
|
}
|