mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #3092 - Implement BackgroundFinalizeTask for parallel garbage collection finalization
This commit is contained in:
+2
-4
@@ -4523,10 +4523,8 @@ PrepareWeakCacheTasks(JSRuntime* rt)
|
||||
WeakCacheTaskVector out;
|
||||
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
|
||||
for (JS::WeakCache<void*>* cache : zone->weakCaches_) {
|
||||
if (!out.append(SweepWeakCacheTask(rt, *cache))) {
|
||||
SweepWeakCachesFromMainThread(rt);
|
||||
return WeakCacheTaskVector();
|
||||
}
|
||||
if (!out.emplaceBack(rt, *cache))
|
||||
return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
||||
@@ -49,6 +49,10 @@ js::CreateHelperThreadsState()
|
||||
{
|
||||
MOZ_ASSERT(!gHelperThreadState);
|
||||
gHelperThreadState = js_new<GlobalHelperThreadState>();
|
||||
return gHelperThreadState != nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
js::DestroyHelperThreadsState()
|
||||
{
|
||||
MOZ_ASSERT(gHelperThreadState);
|
||||
@@ -473,24 +477,6 @@ js::CancelOffThreadParses(JSRuntime* rt)
|
||||
HelperThreadState().wait(lock, GlobalHelperThreadState::CONSUMER);
|
||||
}
|
||||
|
||||
return gHelperThreadState != nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
js::DestroyHelperThreadsState()
|
||||
{
|
||||
MOZ_ASSERT(gHelperThreadState);
|
||||
gHelperThreadState->finish();
|
||||
js_delete(gHelperThreadState);
|
||||
gHelperThreadState = nullptr;
|
||||
// Clean up any parse tasks which haven't been finished by the main thread.
|
||||
AutoUnlockHelperThreadState unlock(lock);
|
||||
HelperThreadState().cancelParseTask(rt->contextFromMainThread(), task->kind, task);
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user