void BrowserStreamParent::NPP_DestroyStream(NPReason reason) { NS_ASSERTION(ALIVE == mState, "NPP_DestroyStream called twice?"); mState = DYING; unused << SendNPP_DestroyStream(reason); }
mozilla::ipc::IPCResult BrowserStreamParent::RecvAsyncNPP_NewStreamResult(const NPError& rv, const uint16_t& stype) { PLUGIN_LOG_DEBUG_FUNCTION; PluginAsyncSurrogate* surrogate = mNPP->GetAsyncSurrogate(); MOZ_ASSERT(surrogate); surrogate->AsyncCallArriving(); if (mState == DEFERRING_DESTROY) { // We've been asked to destroy ourselves before init was complete. mState = DYING; Unused << SendNPP_DestroyStream(mDeferredDestroyReason); return IPC_OK(); } NPError error = rv; if (error == NPERR_NO_ERROR) { if (!mStreamListener) { return IPC_FAIL_NO_REASON(this); } if (mStreamListener->SetStreamType(stype)) { mState = ALIVE; } else { error = NPERR_GENERIC_ERROR; } } if (error != NPERR_NO_ERROR) { surrogate->DestroyAsyncStream(mStream); Unused << PBrowserStreamParent::Send__delete__(this); } return IPC_OK(); }
void BrowserStreamParent::NPP_DestroyStream(NPReason reason) { NS_ASSERTION(ALIVE == mState || INITIALIZING == mState, "NPP_DestroyStream called twice?"); bool stillInitializing = INITIALIZING == mState; if (stillInitializing) { mState = DEFERRING_DESTROY; mDeferredDestroyReason = reason; } else { mState = DYING; Unused << SendNPP_DestroyStream(reason); } }
bool BrowserStreamParent::RecvAsyncNPP_NewStreamResult(const NPError& rv, const uint16_t& stype) { PLUGIN_LOG_DEBUG_FUNCTION; PluginAsyncSurrogate* surrogate = mNPP->GetAsyncSurrogate(); MOZ_ASSERT(surrogate); surrogate->AsyncCallArriving(); nsRefPtr<nsNPAPIPluginStreamListener> streamListener = mStreamListener.forget(); if (mState == DEFERRING_DESTROY) { // We've been asked to destroy ourselves before init was complete. mState = DYING; unused << SendNPP_DestroyStream(mDeferredDestroyReason); return true; } NPError error = rv; if (error == NPERR_NO_ERROR) { if (!streamListener) { return false; } if (streamListener->SetStreamType(stype)) { mState = ALIVE; } else { error = NPERR_GENERIC_ERROR; } } if (error != NPERR_NO_ERROR) { // We need to clean up the stream parent::_destroystream(mNPP->GetNPP(), mStream, NPRES_DONE); unused << PBrowserStreamParent::Send__delete__(this); } return true; }