зеркало из https://github.com/mozilla/gecko-dev.git
Bug 944121: Make js::ParseTask use PersistentRooted instead of AddObjectRoot / JS_RemoveObjectRoot. r=bhackett
This commit is contained in:
Родитель
5aa15ff5f6
Коммит
0330e571cb
|
@ -190,16 +190,10 @@ ParseTask::ParseTask(ExclusiveContext *cx, JSObject *exclusiveContextGlobal, JSC
|
|||
const jschar *chars, size_t length, JSObject *scopeChain,
|
||||
JS::OffThreadCompileCallback callback, void *callbackData)
|
||||
: cx(cx), options(initCx), chars(chars), length(length),
|
||||
alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), scopeChain(scopeChain),
|
||||
exclusiveContextGlobal(exclusiveContextGlobal), callback(callback),
|
||||
alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), scopeChain(initCx, scopeChain),
|
||||
exclusiveContextGlobal(initCx, exclusiveContextGlobal), callback(callback),
|
||||
callbackData(callbackData), script(nullptr), errors(cx), overRecursed(false)
|
||||
{
|
||||
JSRuntime *rt = scopeChain->runtimeFromMainThread();
|
||||
|
||||
if (!AddObjectRoot(rt, &this->scopeChain, "ParseTask::scopeChain"))
|
||||
MOZ_CRASH();
|
||||
if (!AddObjectRoot(rt, &this->exclusiveContextGlobal, "ParseTask::exclusiveContextGlobal"))
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -217,11 +211,6 @@ ParseTask::activate(JSRuntime *rt)
|
|||
|
||||
ParseTask::~ParseTask()
|
||||
{
|
||||
JSRuntime *rt = scopeChain->runtimeFromMainThread();
|
||||
|
||||
JS_RemoveObjectRootRT(rt, &scopeChain);
|
||||
JS_RemoveObjectRootRT(rt, &exclusiveContextGlobal);
|
||||
|
||||
// ParseTask takes over ownership of its input exclusive context.
|
||||
js_delete(cx);
|
||||
|
||||
|
|
|
@ -342,10 +342,10 @@ struct ParseTask
|
|||
// Rooted pointer to the scope in the target compartment which the
|
||||
// resulting script will be merged into. This is not safe to use off the
|
||||
// main thread.
|
||||
JSObject *scopeChain;
|
||||
PersistentRootedObject scopeChain;
|
||||
|
||||
// Rooted pointer to the global object used by 'cx'.
|
||||
JSObject *exclusiveContextGlobal;
|
||||
PersistentRootedObject exclusiveContextGlobal;
|
||||
|
||||
// Callback invoked off the main thread when the parse finishes.
|
||||
JS::OffThreadCompileCallback callback;
|
||||
|
|
Загрузка…
Ссылка в новой задаче