From b21356787406911bdfaa7c42fd01fe93826296d3 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Fri, 12 Jan 2024 09:13:44 +0000 Subject: [PATCH] Bug 1869043 assert that graph set access is main thread only r=padenot Depends on D198225 Differential Revision: https://phabricator.services.mozilla.com/D198226 --- dom/media/MediaTrackGraph.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dom/media/MediaTrackGraph.cpp b/dom/media/MediaTrackGraph.cpp index 203c5f2cf3d0..3eef864e30f4 100644 --- a/dom/media/MediaTrackGraph.cpp +++ b/dom/media/MediaTrackGraph.cpp @@ -153,6 +153,7 @@ struct GraphHasher { // for HashSet using GraphHashSet = HashSet; GraphHashSet* Graphs() { + MOZ_ASSERT(NS_IsMainThread()); static GraphHashSet sGraphs(4); // 4 is minimum HashSet capacity return &sGraphs; } @@ -3595,6 +3596,7 @@ CrossGraphReceiver* MediaTrackGraph::CreateCrossGraphReceiver( void MediaTrackGraph::AddTrack(MediaTrack* aTrack) { MediaTrackGraphImpl* graph = static_cast(this); + MOZ_ASSERT(NS_IsMainThread()); #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED if (graph->mRealtime) { GraphHashSet::Ptr p = Graphs()->lookup(*graph); -- 2.11.4.GIT