NS_IMETHOD Run() { char aLocal; STREAM_LOG(LogLevel::Debug, ("Starting system thread")); profiler_register_thread("MediaStreamGraph", &aLocal); LIFECYCLE_LOG("Starting a new system driver for graph %p\n", mDriver->mGraphImpl); if (mDriver->mPreviousDriver) { LIFECYCLE_LOG("%p releasing an AudioCallbackDriver(%p), for graph %p\n", mDriver, mDriver->mPreviousDriver.get(), mDriver->GraphImpl()); MOZ_ASSERT(!mDriver->AsAudioCallbackDriver()); // Stop and release the previous driver off-main-thread, but only if we're // not in the situation where we've fallen back to a system clock driver // because the osx audio stack is currently switching output device. if (!mDriver->mPreviousDriver->AsAudioCallbackDriver()->IsSwitchingDevice()) { RefPtr<AsyncCubebTask> releaseEvent = new AsyncCubebTask(mDriver->mPreviousDriver->AsAudioCallbackDriver(), AsyncCubebOperation::SHUTDOWN); mDriver->mPreviousDriver = nullptr; releaseEvent->Dispatch(); } } else { MonitorAutoLock mon(mDriver->mGraphImpl->GetMonitor()); MOZ_ASSERT(mDriver->mGraphImpl->MessagesQueued(), "Don't start a graph without messages queued."); mDriver->mGraphImpl->SwapMessageQueues(); } mDriver->RunThread(); return NS_OK; }
void MetroApp::Run() { LogThread(); // Name this thread for debugging and register it with the profiler // as the main gecko thread. char aLocal; PR_SetCurrentThreadName(gGeckoThreadName); profiler_register_thread(gGeckoThreadName, &aLocal); HRESULT hr; hr = sCoreApp->add_Suspending(Callback<__FIEventHandler_1_Windows__CApplicationModel__CSuspendingEventArgs_t>( this, &MetroApp::OnSuspending).Get(), &mSuspendEvent); AssertHRESULT(hr); hr = sCoreApp->add_Resuming(Callback<__FIEventHandler_1_IInspectable_t>( this, &MetroApp::OnResuming).Get(), &mResumeEvent); AssertHRESULT(hr); Log("XPCOM startup initialization began"); nsresult rv = XRE_metroStartup(true); Log("XPCOM startup initialization complete"); if (NS_FAILED(rv)) { Log("XPCOM startup initialization failed, bailing. rv=%X", rv); CoreExit(); } }
NS_IMETHOD Run() { char aLocal; STREAM_LOG(PR_LOG_DEBUG, ("Starting system thread")); profiler_register_thread("MediaStreamGraph", &aLocal); LIFECYCLE_LOG("Starting a new system driver for graph %p\n", mDriver->mGraphImpl); if (mDriver->mPreviousDriver) { LIFECYCLE_LOG("%p releasing an AudioCallbackDriver(%p), for graph %p\n", mDriver, mDriver->mPreviousDriver.get(), mDriver->GraphImpl()); MOZ_ASSERT(!mDriver->AsAudioCallbackDriver()); // Stop and release the previous driver off-main-thread. nsRefPtr<AsyncCubebTask> releaseEvent = new AsyncCubebTask(mDriver->mPreviousDriver->AsAudioCallbackDriver(), AsyncCubebTask::SHUTDOWN); mDriver->mPreviousDriver = nullptr; releaseEvent->Dispatch(); } else { MonitorAutoLock mon(mDriver->mGraphImpl->GetMonitor()); MOZ_ASSERT(mDriver->mGraphImpl->MessagesQueued(), "Don't start a graph without messages queued."); mDriver->mGraphImpl->SwapMessageQueues(); } mDriver->RunThread(); return NS_OK; }
void LazyIdleThread::InitThread() { char aLocal; profiler_register_thread(mName.get(), &aLocal); PR_SetCurrentThreadName(mName.get()); // Happens on mThread but mThread may not be set yet... nsCOMPtr<nsIThreadInternal> thread(do_QueryInterface(NS_GetCurrentThread())); MOZ_ASSERT(thread, "This should always succeed!"); if (NS_FAILED(thread->SetObserver(this))) { NS_WARNING("Failed to set thread observer!"); } }