mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Backed out 3 changesets 74668b4ab3ea c612cd6788e0 418acf685ec2 (bug 1255737) for shutdown leaks
on a CLOSED TREE
This commit is contained in:
parent
d95ef53b00
commit
78bb875898
@ -1448,14 +1448,11 @@ MediaStreamGraphImpl::ForceShutDown(ShutdownTicket* aShutdownTicket)
|
||||
|
||||
namespace {
|
||||
|
||||
class MediaStreamGraphShutDownRunnable : public Runnable
|
||||
, public nsITimerCallback {
|
||||
class MediaStreamGraphShutDownRunnable : public Runnable {
|
||||
public:
|
||||
explicit MediaStreamGraphShutDownRunnable(MediaStreamGraphImpl* aGraph)
|
||||
: mGraph(aGraph)
|
||||
{}
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
NS_ASSERTION(mGraph->mDetectedNotRunning,
|
||||
@ -1474,32 +1471,10 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
// Avoid waiting forever for a callback driver to shut down
|
||||
// synchronously. Reports are that some 3rd-party audio drivers
|
||||
// occasionally hang in shutdown (both for us and Chrome).
|
||||
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
if (!mTimer) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mTimer->InitWithCallback(this,
|
||||
MediaStreamGraph::AUDIO_CALLBACK_DRIVER_SHUTDOWN_TIMEOUT,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
|
||||
mGraph->mDriver->Shutdown(); // This will wait until it's shutdown since
|
||||
// we'll start tearing down the graph after this
|
||||
|
||||
// We may be one of several graphs. Drop ticket to eventually unblock shutdown.
|
||||
if (!mGraph->mForceShutdownTicket) {
|
||||
// XXX - this should be NS_ASSERTION, but that kicks out on linux32 test VMs
|
||||
NS_WARNING(
|
||||
"AudioCallbackDriver took too long to shut down and we let shutdown"
|
||||
" continue - freezing and leaking");
|
||||
|
||||
// The timer fired, so we may be deeper in shutdown now. Block any further
|
||||
// teardown and just leak, for safety.
|
||||
return NS_OK;
|
||||
}
|
||||
mTimer = nullptr;
|
||||
mGraph->mForceShutdownTicket = nullptr;
|
||||
|
||||
// We can't block past the final LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION
|
||||
@ -1532,30 +1507,10 @@ public:
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD Notify(nsITimer* aTimer) override
|
||||
{
|
||||
// Sigh, driver took too long to shut down. Stop blocking system
|
||||
// shutdown and hope all is well. Shutdown of this graph will proceed
|
||||
// if the driver eventually comes back.
|
||||
NS_ASSERTION(!(mGraph->mForceShutdownTicket),
|
||||
"AudioCallbackDriver took too long to shut down - probably hung");
|
||||
|
||||
mGraph->mForceShutdownTicket = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~MediaStreamGraphShutDownRunnable() {}
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
RefPtr<MediaStreamGraphImpl> mGraph;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(MediaStreamGraphShutDownRunnable, Runnable, nsITimerCallback)
|
||||
|
||||
|
||||
|
||||
class MediaStreamGraphStableStateRunnable : public Runnable {
|
||||
public:
|
||||
explicit MediaStreamGraphStableStateRunnable(MediaStreamGraphImpl* aGraph,
|
||||
@ -3308,8 +3263,7 @@ MediaStreamGraph::GetInstance(MediaStreamGraph::GraphDriverType aGraphDriverRequ
|
||||
public:
|
||||
Blocker()
|
||||
: media::ShutdownBlocker(NS_LITERAL_STRING(
|
||||
"MediaStreamGraph shutdown: blocking on msg thread"))
|
||||
{}
|
||||
"MediaStreamGraph shutdown: blocking on msg thread")) {}
|
||||
|
||||
NS_IMETHOD
|
||||
BlockShutdown(nsIAsyncShutdownClient* aProfileBeforeChange) override
|
||||
|
@ -1252,8 +1252,6 @@ public:
|
||||
SYSTEM_THREAD_DRIVER,
|
||||
OFFLINE_THREAD_DRIVER
|
||||
};
|
||||
static const uint32_t AUDIO_CALLBACK_DRIVER_SHUTDOWN_TIMEOUT = 45*1000;
|
||||
|
||||
// Main thread only
|
||||
static MediaStreamGraph* GetInstance(GraphDriverType aGraphDriverRequested,
|
||||
dom::AudioChannel aChannel);
|
||||
|
Loading…
Reference in New Issue
Block a user