Let jsc know it will run web worker

Reviewed By: astreet

Differential Revision: D3287543

fbshipit-source-id: 2a9de938feec417aef34c0ff26f138730b32929f
This commit is contained in:
Michał Gregorczyk 2016-05-12 08:12:15 -07:00 committed by Facebook Github Bot 3
parent 44bf85a041
commit cd691e2cc2
2 changed files with 10 additions and 4 deletions

View File

@ -392,10 +392,13 @@ int JSCExecutor::addWebWorker(
Object globalObj = Value(m_context, globalObjRef).asObject();
auto workerJscConfig = m_jscConfig;
workerJscConfig["isWebWorker"] = true;
auto workerMQT = WebWorkerUtil::createWebWorkerThread(workerId, m_messageQueueThread.get());
std::unique_ptr<JSCExecutor> worker;
workerMQT->runOnQueueSync([this, &worker, &script, &globalObj, workerId] () {
worker.reset(new JSCExecutor(m_bridge, workerId, this, script, globalObj.toJSONMap(), m_jscConfig));
workerMQT->runOnQueueSync([this, &worker, &script, &globalObj, workerId, &workerJscConfig] () {
worker.reset(new JSCExecutor(m_bridge, workerId, this, script, globalObj.toJSONMap(), workerJscConfig));
});
Object workerObj = Value(m_context, workerRef).asObject();

View File

@ -320,12 +320,15 @@ int JSCExecutor::addWebWorker(
Object globalObj = Value(m_context, globalObjRef).asObject();
auto workerJscConfig = m_jscConfig;
workerJscConfig["isWebWorker"] = true;
std::shared_ptr<MessageQueueThread> workerMQT =
WebWorkerUtil::createWebWorkerThread(workerId, m_messageQueueThread.get());
std::unique_ptr<JSCExecutor> worker;
workerMQT->runOnQueueSync([this, &worker, &workerMQT, &script, &globalObj, workerId] () {
workerMQT->runOnQueueSync([this, &worker, &workerMQT, &script, &globalObj, workerId, &workerJscConfig] () {
worker.reset(new JSCExecutor(m_bridge, workerMQT, workerId, this, script,
globalObj.toJSONMap(), m_jscConfig));
globalObj.toJSONMap(), workerJscConfig));
});
Object workerObj = Value(m_context, workerRef).asObject();