mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1299172 - Assert on MSG thread in DispatchToMainThreadAfterStreamStateUpdate. r=jesup
MozReview-Commit-ID: 9ihJduZOSa --HG-- extra : rebase_source : 1088fc98f97456c933f146565ba91ce0358e6a4c
This commit is contained in:
parent
6f362db5ba
commit
b8ed2ee25c
@ -1077,6 +1077,25 @@ MediaStreamGraph::NotifyOutputData(AudioDataValue* aBuffer, size_t aFrames,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaStreamGraph::AssertOnGraphThreadOrNotRunning() const
|
||||
{
|
||||
// either we're on the right thread (and calling CurrentDriver() is safe),
|
||||
// or we're going to assert anyways, so don't cross-check CurrentDriver
|
||||
#ifdef DEBUG
|
||||
MediaStreamGraphImpl const * graph =
|
||||
static_cast<MediaStreamGraphImpl const *>(this);
|
||||
// if all the safety checks fail, assert we own the monitor
|
||||
if (!graph->mDriver->OnThread()) {
|
||||
if (!(graph->mDetectedNotRunning &&
|
||||
graph->mLifecycleState > MediaStreamGraphImpl::LIFECYCLE_RUNNING &&
|
||||
NS_IsMainThread())) {
|
||||
graph->mMonitor.AssertCurrentThreadOwns();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
MediaStreamGraphImpl::ShouldUpdateMainThread()
|
||||
{
|
||||
|
@ -1353,6 +1353,7 @@ public:
|
||||
*/
|
||||
virtual void DispatchToMainThreadAfterStreamStateUpdate(already_AddRefed<nsIRunnable> aRunnable)
|
||||
{
|
||||
AssertOnGraphThreadOrNotRunning();
|
||||
*mPendingUpdateRunnables.AppendElement() = aRunnable;
|
||||
}
|
||||
|
||||
@ -1374,6 +1375,8 @@ public:
|
||||
void NotifyOutputData(AudioDataValue* aBuffer, size_t aFrames,
|
||||
TrackRate aRate, uint32_t aChannels);
|
||||
|
||||
void AssertOnGraphThreadOrNotRunning() const;
|
||||
|
||||
protected:
|
||||
explicit MediaStreamGraph(TrackRate aSampleRate)
|
||||
: mSampleRate(aSampleRate)
|
||||
|
@ -202,24 +202,8 @@ public:
|
||||
nsISupports* aData,
|
||||
const nsTArray<AudioNodeSizes>& aAudioStreamSizes);
|
||||
|
||||
// The following methods run on the graph thread (or possibly the main thread if
|
||||
// mLifecycleState > LIFECYCLE_RUNNING)
|
||||
void AssertOnGraphThreadOrNotRunning() const
|
||||
{
|
||||
// either we're on the right thread (and calling CurrentDriver() is safe),
|
||||
// or we're going to assert anyways, so don't cross-check CurrentDriver
|
||||
#ifdef DEBUG
|
||||
// if all the safety checks fail, assert we own the monitor
|
||||
if (!mDriver->OnThread()) {
|
||||
if (!(mDetectedNotRunning &&
|
||||
mLifecycleState > LIFECYCLE_RUNNING &&
|
||||
NS_IsMainThread())) {
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// The following methods run on the graph thread (or possibly the main thread
|
||||
// if mLifecycleState > LIFECYCLE_RUNNING)
|
||||
void CollectSizesForMemoryReport(
|
||||
already_AddRefed<nsIHandleReportCallback> aHandleReport,
|
||||
already_AddRefed<nsISupports> aHandlerData);
|
||||
|
Loading…
Reference in New Issue
Block a user