mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1211337 - Added crash report annotations tracking sync shutdown process. r=cpearce
This commit is contained in:
parent
e4971e5da5
commit
7565841964
@ -267,16 +267,28 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
|
||||
if (gmpThread) {
|
||||
LOGD(("%s::%s Starting to unload plugins, waiting for first sync shutdown..."
|
||||
, __CLASS__, __FUNCTION__));
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(nullptr, '0',
|
||||
NS_LITERAL_CSTRING("Dispatching UnloadPlugins"));
|
||||
#endif
|
||||
gmpThread->Dispatch(
|
||||
NS_NewRunnableMethod(this,
|
||||
&GeckoMediaPluginServiceParent::UnloadPlugins),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(nullptr, '1',
|
||||
NS_LITERAL_CSTRING("Waiting for sync shutdown"));
|
||||
#endif
|
||||
// Wait for UnloadPlugins() to do initial sync shutdown...
|
||||
while (mWaitingForPluginsSyncShutdown) {
|
||||
NS_ProcessNextEvent(NS_GetCurrentThread(), true);
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(nullptr, '4',
|
||||
NS_LITERAL_CSTRING("Waiting for async shutdown"));
|
||||
#endif
|
||||
// Wait for other plugins (if any) to do async shutdown...
|
||||
auto syncShutdownPluginsRemaining =
|
||||
std::numeric_limits<decltype(mAsyncShutdownPlugins.Length())>::max();
|
||||
@ -311,6 +323,10 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
|
||||
}
|
||||
NS_ProcessNextEvent(NS_GetCurrentThread(), true);
|
||||
}
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(nullptr, '5',
|
||||
NS_LITERAL_CSTRING("Async shutdown complete"));
|
||||
#endif
|
||||
} else {
|
||||
// GMP thread has already shutdown.
|
||||
MOZ_ASSERT(mPlugins.IsEmpty());
|
||||
@ -413,6 +429,13 @@ GeckoMediaPluginServiceParent::SetAsyncShutdownPluginState(GMPParent* aGMPParent
|
||||
const nsCString& aState)
|
||||
{
|
||||
MutexAutoLock lock(mAsyncShutdownPluginStatesMutex);
|
||||
if (!aGMPParent) {
|
||||
mAsyncShutdownPluginStates.Update(NS_LITERAL_CSTRING("-"),
|
||||
NS_LITERAL_CSTRING("-"),
|
||||
aId,
|
||||
aState);
|
||||
return;
|
||||
}
|
||||
mAsyncShutdownPluginStates.Update(aGMPParent->GetDisplayName(),
|
||||
nsPrintfCString("%p", aGMPParent),
|
||||
aId,
|
||||
@ -479,6 +502,10 @@ GeckoMediaPluginServiceParent::UnloadPlugins()
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
MOZ_ASSERT(!mShuttingDownOnGMPThread);
|
||||
mShuttingDownOnGMPThread = true;
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(nullptr, '2',
|
||||
NS_LITERAL_CSTRING("Starting to unload plugins"));
|
||||
#endif
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
@ -497,11 +524,19 @@ GeckoMediaPluginServiceParent::UnloadPlugins()
|
||||
// Note: CloseActive may be async; it could actually finish
|
||||
// shutting down when all the plugins have unloaded.
|
||||
for (size_t i = 0; i < mPlugins.Length(); i++) {
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(mPlugins[i], 'S',
|
||||
NS_LITERAL_CSTRING("CloseActive"));
|
||||
#endif
|
||||
mPlugins[i]->CloseActive(true);
|
||||
}
|
||||
mPlugins.Clear();
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
SetAsyncShutdownPluginState(nullptr, '3',
|
||||
NS_LITERAL_CSTRING("Dispatching sync-shutdown-complete"));
|
||||
#endif
|
||||
nsCOMPtr<nsIRunnable> task(NS_NewRunnableMethod(
|
||||
this, &GeckoMediaPluginServiceParent::NotifySyncShutdownComplete));
|
||||
NS_DispatchToMainThread(task);
|
||||
|
Loading…
Reference in New Issue
Block a user