2012-05-03 10:56:41 -07:00
|
|
|
#include "rr.h"
|
|
|
|
|
|
|
|
namespace rr {
|
2012-05-03 15:21:25 -07:00
|
|
|
|
2015-03-18 21:50:59 +00:00
|
|
|
v8::Platform* V8::v8_platform = NULL;
|
|
|
|
|
|
|
|
void V8::Init() {
|
|
|
|
// Initialize V8.
|
|
|
|
v8::V8::InitializeICU();
|
|
|
|
v8_platform = v8::platform::CreateDefaultPlatform();
|
|
|
|
v8::V8::InitializePlatform(v8_platform);
|
|
|
|
v8::V8::Initialize();
|
2012-05-03 15:21:25 -07:00
|
|
|
|
2015-03-18 21:50:59 +00:00
|
|
|
ClassBuilder("V8").
|
|
|
|
// defineSingletonMethod("IdleNotification", &IdleNotification).
|
|
|
|
// defineSingletonMethod("SetFlagsFromString", &SetFlagsFromString).
|
|
|
|
// defineSingletonMethod("SetFlagsFromCommandLine", &SetFlagsFromCommandLine).
|
|
|
|
// defineSingletonMethod("PauseProfiler", &PauseProfiler).
|
|
|
|
// defineSingletonMethod("ResumeProfiler", &ResumeProfiler).
|
|
|
|
// defineSingletonMethod("IsProfilerPaused", &IsProfilerPaused).
|
|
|
|
// defineSingletonMethod("GetCurrentThreadId", &GetCurrentThreadId).
|
|
|
|
// defineSingletonMethod("TerminateExecution", &TerminateExecution).
|
|
|
|
// defineSingletonMethod("IsExecutionTerminating", &IsExecutionTerminating).
|
|
|
|
defineSingletonMethod("Dispose", &Dispose).
|
|
|
|
// defineSingletonMethod("LowMemoryNotification", &LowMemoryNotification).
|
|
|
|
// defineSingletonMethod("AdjustAmountOfExternalAllocatedMemory", &AdjustAmountOfExternalAllocatedMemory).
|
|
|
|
// defineSingletonMethod("ContextDisposedNotification", &ContextDisposedNotification).
|
|
|
|
// defineSingletonMethod("SetCaptureStackTraceForUncaughtExceptions", &SetCaptureStackTraceForUncaughtExceptions).
|
|
|
|
// defineSingletonMethod("GetHeapStatistics", &GetHeapStatistics).
|
|
|
|
defineSingletonMethod("GetVersion", &GetVersion);
|
2012-06-08 02:29:16 -05:00
|
|
|
}
|
2015-03-18 21:50:59 +00:00
|
|
|
|
|
|
|
VALUE V8::Dispose(VALUE self) {
|
|
|
|
v8::V8::Dispose();
|
|
|
|
v8::V8::ShutdownPlatform();
|
|
|
|
|
|
|
|
if (v8_platform) {
|
|
|
|
delete v8_platform;
|
|
|
|
v8_platform = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Qnil;
|
2012-06-19 04:32:58 -05:00
|
|
|
}
|
2015-03-18 21:50:59 +00:00
|
|
|
|
|
|
|
VALUE V8::GetVersion(VALUE self) {
|
|
|
|
return rb_str_new2(v8::V8::GetVersion());
|
|
|
|
}
|
|
|
|
|
2012-06-14 03:52:32 -05:00
|
|
|
}
|