JSMainThreadExecState.cpp [plain text]
#include "config.h"
#include "JSMainThreadExecState.h"
#include "Microtasks.h"
#include "RejectedPromiseTracker.h"
#include "ScriptExecutionContext.h"
#include "ScriptState.h"
namespace WebCore {
JSC::ExecState* JSMainThreadExecState::s_mainThreadState = 0;
void JSMainThreadExecState::didLeaveScriptContext(JSC::ExecState* exec)
{
MicrotaskQueue::mainThreadQueue().performMicrotaskCheckpoint();
scriptExecutionContextFromExecState(exec)->ensureRejectedPromiseTracker().processQueueSoon();
}
JSC::JSValue functionCallHandlerFromAnyThread(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args, NakedPtr<JSC::Exception>& returnedException)
{
if (isMainThread())
return JSMainThreadExecState::call(exec, functionObject, callType, callData, thisValue, args, returnedException);
return JSC::call(exec, functionObject, callType, callData, thisValue, args, returnedException);
}
JSC::JSValue evaluateHandlerFromAnyThread(JSC::ExecState* exec, const JSC::SourceCode& source, JSC::JSValue thisValue, NakedPtr<JSC::Exception>& returnedException)
{
if (isMainThread())
return JSMainThreadExecState::evaluate(exec, source, thisValue, returnedException);
return JSC::evaluate(exec, source, thisValue, returnedException);
}
}