1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/v8.cc

50 lines
1.8 KiB
C++
Raw Normal View History

#include "rr.h"
namespace rr {
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();
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);
}
VALUE V8::Dispose(VALUE self) {
v8::V8::Dispose();
v8::V8::ShutdownPlatform();
if (v8_platform) {
delete v8_platform;
v8_platform = NULL;
}
return Qnil;
}
VALUE V8::GetVersion(VALUE self) {
return rb_str_new2(v8::V8::GetVersion());
}
2012-06-14 03:52:32 -05:00
}