void LazyIdleThread::CleanupThread() { nsCOMPtr<nsIThreadInternal> thread(do_QueryInterface(NS_GetCurrentThread())); MOZ_ASSERT(thread, "This should always succeed!"); if (NS_FAILED(thread->SetObserver(nullptr))) { NS_WARNING("Failed to set thread observer!"); } { MutexAutoLock lock(mMutex); MOZ_ASSERT(!mThreadIsShuttingDown, "Shouldn't be true ever!"); mThreadIsShuttingDown = true; } profiler_unregister_thread(); }
// Free all xpcom related resources before calling the xre shutdown call. // Must be called on the metro main thread. Currently called from appshell. void MetroApp::ShutdownXPCOM() { LogThread(); if (sCoreApp) { sCoreApp->remove_Suspending(mSuspendEvent); sCoreApp->remove_Resuming(mResumeEvent); } if (sFrameworkView) { sFrameworkView->ShutdownXPCOM(); } // Shut down xpcom XRE_metroShutdown(); // Unhook this thread from the profiler profiler_unregister_thread(); }
~AutoProfilerUnregisterThread() { profiler_unregister_thread(); }