Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,17 @@ py::object CContext::Evaluate(const std::string& src,

CScriptPtr script = engine.Compile(src, name, line, col);

return script->Run();
boost::python::api::object result = script->Run();

while (v8::platform::PumpMessageLoop(
CPlatform::GetPlatform(),
v8::Isolate::GetCurrent(),
v8::platform::MessageLoopBehavior::kDoNotWait
)) {
v8::Isolate::GetCurrent()->PerformMicrotaskCheckpoint();
}

return result;
}

py::object CContext::EvaluateW(const std::wstring& src,
Expand All @@ -210,5 +220,15 @@ py::object CContext::EvaluateW(const std::wstring& src,

CScriptPtr script = engine.CompileW(src, name, line, col);

return script->Run();
boost::python::api::object result = script->Run();

while (v8::platform::PumpMessageLoop(
CPlatform::GetPlatform(),
v8::Isolate::GetCurrent(),
v8::platform::MessageLoopBehavior::kDoNotWait
)) {
v8::Isolate::GetCurrent()->PerformMicrotaskCheckpoint();
}

return result;
}
5 changes: 5 additions & 0 deletions src/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ void CPlatform::Init()

inited = true;
}

v8::Platform *CPlatform::GetPlatform(void)
{
return CPlatform::platform.get();
}
1 change: 1 addition & 0 deletions src/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ class CPlatform
CPlatform(std::string argv0) : argv(argv0) {};
~CPlatform() {};
void Init();
static v8::Platform *GetPlatform(void);
};