Bug 1943912 - Do not reset the chunk manager while shutdown a=dmeehan

Original Revision: https://phabricator.services.mozilla.com/D235642

Differential Revision: https://phabricator.services.mozilla.com/D237219
This commit is contained in:
Nazım Can Altınova 2025-02-07 20:25:55 +00:00
parent 97dfb547ef
commit ade99491c4
2 changed files with 10 additions and 4 deletions

View file

@ -139,6 +139,12 @@ void ProfilerChild::SetupChunkManager() {
});
}
/* static */ void ProfilerChild::ClearPendingUpdate() {
auto lockedUpdate = sPendingChunkManagerUpdate.Lock();
lockedUpdate->mProfilerChild = nullptr;
lockedUpdate->mUpdate.Clear();
}
void ProfilerChild::ResetChunkManager() {
if (!mChunkManager) {
return;
@ -149,9 +155,7 @@ void ProfilerChild::ResetChunkManager() {
mChunkManager->SetUpdateCallback({});
// Clear the pending update.
auto lockedUpdate = sPendingChunkManagerUpdate.Lock();
lockedUpdate->mProfilerChild = nullptr;
lockedUpdate->mUpdate.Clear();
ClearPendingUpdate();
// And process a final update right now.
ProcessChunkManagerUpdate(
ProfileBufferControlledChunkManager::Update(nullptr));
@ -483,7 +487,7 @@ void ProfilerChild::ActorDestroy(ActorDestroyReason aActorDestroyReason) {
}
void ProfilerChild::Destroy() {
ResetChunkManager();
ClearPendingUpdate();
if (!mDestroyed) {
Close();
}

View file

@ -81,6 +81,8 @@ class ProfilerChild final : public PProfilerChild,
void ProcessChunkManagerUpdate(
ProfileBufferControlledChunkManager::Update&& aUpdate);
static void ClearPendingUpdate();
static void GatherProfileThreadFunction(void* already_AddRefedParameters);
nsCOMPtr<nsIThread> mThread;