Fixes for v8 3.17.10 (0x031710)

This commit is contained in:
Richard 2014-08-12 12:03:07 -05:00
commit 8ee40e408b

View file

@ -70,7 +70,13 @@ V8Shell::~V8Shell() {}
bool V8Shell::RunScript(const std::string& scriptPath) { bool V8Shell::RunScript(const std::string& scriptPath) {
if (!context.IsEmpty()) { if (!context.IsEmpty()) {
#if (V8_VERSION < 0x031710)
context.Dispose(); context.Dispose();
#elif (V8_VERSION < 0x031900)
context.Dispose(v8::Isolate::GetCurrent());
#else
context.Dispose();
#endif
} }
std::string source = ReadFile(scriptPath); std::string source = ReadFile(scriptPath);
@ -85,7 +91,15 @@ bool V8Shell::RunScript(const std::string& scriptPath) {
bool success = _ExecuteScript(source, scriptPath); bool success = _ExecuteScript(source, scriptPath);
context->Exit(); context->Exit();
context.Dispose();
#if (V8_VERSION < 0x031710)
context.Dispose();
#elif (V8_VERSION < 0x031900)
context.Dispose(v8::Isolate::GetCurrent());
#else
context.Dispose();
#endif
v8::V8::Dispose(); v8::V8::Dispose();
return true; return true;
@ -112,7 +126,13 @@ bool V8Shell::_ExecuteScript(const std::string& source, const std::string& scrip
bool V8Shell::RunShell() { bool V8Shell::RunShell() {
if (!context.IsEmpty()) { if (!context.IsEmpty()) {
#if (V8_VERSION < 0x031710)
context.Dispose();
#elif (V8_VERSION < 0x031900)
context.Dispose(v8::Isolate::GetCurrent());
#else
context.Dispose(); context.Dispose();
#endif
} }
context = CreateShellContext(); context = CreateShellContext();
@ -139,7 +159,13 @@ bool V8Shell::RunShell() {
printf("\n"); printf("\n");
context->Exit(); context->Exit();
#if (V8_VERSION < 0x031710)
context.Dispose();
#elif (V8_VERSION < 0x031900)
context.Dispose(v8::Isolate::GetCurrent());
#else
context.Dispose(); context.Dispose();
#endif
v8::V8::Dispose(); v8::V8::Dispose();
return true; return true;