Bug 1233152 - Use PersistentRooted for ParseTask script and sourceObject. r=terrence

This commit is contained in:
Jan de Mooij 2015-12-30 13:28:13 +01:00
parent c31028f3b1
commit aa7429333c
2 changed files with 5 additions and 4 deletions

View File

@ -202,7 +202,8 @@ ParseTask::ParseTask(ExclusiveContext* cx, JSObject* exclusiveContextGlobal, JSC
alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE),
exclusiveContextGlobal(initCx->runtime(), exclusiveContextGlobal),
callback(callback), callbackData(callbackData),
script(nullptr), sourceObject(nullptr), errors(cx), overRecursed(false)
script(initCx->runtime()), sourceObject(initCx->runtime()),
errors(cx), overRecursed(false)
{
}
@ -1384,7 +1385,7 @@ HelperThread::handleParseWorkload()
task->options, srcBuf,
/* source_ = */ nullptr,
/* extraSct = */ nullptr,
/* sourceObjectOut = */ &(task->sourceObject));
/* sourceObjectOut = */ task->sourceObject.address());
}
// The callback is invoked while we are still off the main thread.

View File

@ -479,10 +479,10 @@ struct ParseTask
// Holds the final script between the invocation of the callback and the
// point where FinishOffThreadScript is called, which will destroy the
// ParseTask.
JSScript* script;
PersistentRootedScript script;
// Holds the ScriptSourceObject generated for the script compilation.
ScriptSourceObject* sourceObject;
PersistentRooted<ScriptSourceObject*> sourceObject;
// Any errors or warnings produced during compilation. These are reported
// when finishing the script.