void GMPParent::Shutdown() { LOGD(("%s::%s: %p", __CLASS__, __FUNCTION__, this)); MOZ_ASSERT(GMPThread() == NS_GetCurrentThread()); if (mAbnormalShutdownInProgress) { return; } MOZ_ASSERT(mVideoDecoders.IsEmpty() && mVideoEncoders.IsEmpty()); if (mState == GMPStateNotLoaded || mState == GMPStateClosing) { return; } mState = GMPStateClosing; DeleteProcess(); // XXX Get rid of mDeleteProcessOnlyOnUnload and this code when // Bug 1043671 is fixed if (!mDeleteProcessOnlyOnUnload) { // Destroy ourselves and rise from the fire to save memory nsRefPtr<GMPParent> self(this); mService->ReAddOnGMPThread(self); } // else we've been asked to die and stay dead MOZ_ASSERT(mState == GMPStateNotLoaded); }
JBoolean CBCtagsUser::ProcessFile ( const JCharacter* fileName, const CBTextFileType fileType, JString* result, CBLanguage* lang ) { if (!StartProcess(fileType, lang)) { result->Clear(); return kJFalse; } *itsCmdPipe << fileName << endl; JBoolean found; *result = JReadUntil(itsResultFD, kDelimiter, &found); if (found) { return kJTrue; } else if (itsTryRestartFlag) { DeleteProcess(); itsTryRestartFlag = kJFalse; const JBoolean ok = ProcessFile(fileName, fileType, result, lang); itsTryRestartFlag = kJTrue; return ok; } else { DeleteProcess(); itsIsActiveFlag = kJFalse; if (!CBInUpdateThread()) { (JGetUserNotification())->ReportError( "ctags is not responding correctly, " "so some features will not work."); } return kJFalse; } }
void CBCtagsUser::SetCtagsArgs ( const JCharacter* args ) { itsArgs = args; DeleteProcess(); // force restart }
void GMPParent::Shutdown() { MOZ_ASSERT(GMPThread() == NS_GetCurrentThread()); MOZ_ASSERT(mVideoDecoders.IsEmpty() && mVideoEncoders.IsEmpty()); if (mState == GMPStateNotLoaded || mState == GMPStateClosing) { return; } mState = GMPStateClosing; Close(); DeleteProcess(); MOZ_ASSERT(mState == GMPStateNotLoaded); }
JBoolean CBCtagsUser::StartProcess ( const CBTextFileType fileType, CBLanguage* lang ) { *lang = kCBOtherLang; if (itsIsActiveFlag && itsProcess == NULL) { JString cmd = kBaseExecCmd; cmd += itsArgs; int toFD, fromFD; const JError err = JProcess::Create(&itsProcess, cmd, kJCreatePipe, &toFD, kJCreatePipe, &fromFD); if (err.OK()) { ListenTo(itsProcess); itsCmdPipe = new JOutPipeStream(toFD, kJTrue); assert( itsCmdPipe != NULL ); itsResultFD = fromFD; assert( itsResultFD != ACE_INVALID_HANDLE ); InitCtags(*itsCmdPipe); } else { itsIsActiveFlag = kJFalse; DeleteProcess(); } } if (itsProcess != NULL) { assert( kFTCount == kCBFTCount && kFTInfo[fileType].fileType == fileType ); *lang = kFTInfo[fileType].lang; *itsCmdPipe << kFTInfo[fileType].cmd << endl; } return itsIsActiveFlag; }
void CBCtagsUser::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == itsProcess && message.Is(JProcess::kFinished)) { DeleteProcess(); } else { JBroadcaster::Receive(sender, message); } }
JBoolean CBSymbolList::UpdateFinished ( const JArray<JFAID_t>& deadFileList, JProgressDisplay& pg ) { DeleteProcess(); // reset to lenient search itsSymbolList->SetCompareFunction(CompareSymbols); // toss files that no longer exist const JSize fileCount = deadFileList.GetElementCount(); if (fileCount > 0) { pg.FixedLengthProcessBeginning(fileCount, JGetString(kCleaningUpID), kJFalse, kJTrue); for (JIndex i=1; i<=fileCount; i++) { RemoveFile(deadFileList.GetElement(i)); pg.IncrementProgress(); } pg.ProcessFinished(); } if (itsChangedDuringParseFlag && !CBInUpdateThread()) { itsReparseAllFlag = kJFalse; Broadcast(Changed()); } return itsChangedDuringParseFlag; }
CBCtagsUser::~CBCtagsUser() { DeleteProcess(); }
CLockServerTester::~CLockServerTester() { DeleteProcess(); }