mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=1020411 correct control message order with RunAfterPendingUpdates() at shutdown r=roc
--HG-- extra : transplant_source : %AE%05%92%2C%60%9FL%D0%13O%EE%7D%09ZV%87%06%E9%B6%D8
This commit is contained in:
parent
b2353db8a8
commit
db2546467c
@ -1703,6 +1703,11 @@ MediaStreamGraphImpl::RunInStableState()
|
||||
for (uint32_t i = 0; i < controlMessagesToRunDuringShutdown.Length(); ++i) {
|
||||
controlMessagesToRunDuringShutdown[i]->RunDuringShutdown();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
mCanRunMessagesSynchronously = mDetectedNotRunning &&
|
||||
mLifecycleState >= LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
@ -1752,7 +1757,14 @@ MediaStreamGraphImpl::AppendMessage(ControlMessage* aMessage)
|
||||
// this message.
|
||||
// This should only happen during forced shutdown, or after a non-realtime
|
||||
// graph has finished processing.
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(mCanRunMessagesSynchronously);
|
||||
mCanRunMessagesSynchronously = false;
|
||||
#endif
|
||||
aMessage->RunDuringShutdown();
|
||||
#ifdef DEBUG
|
||||
mCanRunMessagesSynchronously = true;
|
||||
#endif
|
||||
delete aMessage;
|
||||
if (IsEmpty() &&
|
||||
mLifecycleState >= LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION) {
|
||||
@ -2176,7 +2188,10 @@ MediaStream::RunAfterPendingUpdates(nsRefPtr<nsIRunnable> aRunnable)
|
||||
}
|
||||
virtual void RunDuringShutdown() MOZ_OVERRIDE
|
||||
{
|
||||
mRunnable->Run();
|
||||
// Don't run mRunnable now as it may call AppendMessage() which would
|
||||
// assume that there are no remaining controlMessagesToRunDuringShutdown.
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_DispatchToCurrentThread(mRunnable);
|
||||
}
|
||||
private:
|
||||
nsRefPtr<nsIRunnable> mRunnable;
|
||||
@ -2656,6 +2671,9 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(bool aRealtime, TrackRate aSampleRate
|
||||
, mSelfRef(MOZ_THIS_IN_INITIALIZER_LIST())
|
||||
, mAudioStreamSizes()
|
||||
, mNeedsMemoryReport(false)
|
||||
#ifdef DEBUG
|
||||
, mCanRunMessagesSynchronously(false)
|
||||
#endif
|
||||
{
|
||||
#ifdef PR_LOGGING
|
||||
if (!gMediaStreamGraphLog) {
|
||||
|
@ -382,7 +382,8 @@ public:
|
||||
* updates that were sent from the graph thread or will be sent before the
|
||||
* graph thread receives the next graph update.
|
||||
*
|
||||
* If the graph has been shutdown or destroyed, or if it is non-realtime
|
||||
* If the graph has been shut down or destroyed, then the runnable will be
|
||||
* dispatched to the event queue immediately. If the graph is non-realtime
|
||||
* and has not started, then the runnable will be run
|
||||
* synchronously/immediately. (There are no pending updates in these
|
||||
* situations.)
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
virtual void Run() = 0;
|
||||
// When we're shutting down the application, most messages are ignored but
|
||||
// some cleanup messages should still be processed (on the main thread).
|
||||
// This must not add new control messages to the graph.
|
||||
virtual void RunDuringShutdown() {}
|
||||
MediaStream* GetStream() { return mStream; }
|
||||
|
||||
@ -642,6 +643,14 @@ private:
|
||||
* Indicates that the MSG thread should gather data for a memory report.
|
||||
*/
|
||||
bool mNeedsMemoryReport;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Used to assert when AppendMessage() runs ControlMessages synchronously.
|
||||
*/
|
||||
bool mCanRunMessagesSynchronously;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user