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

View file

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