void TransferItem::FinishedURLPutData() { m_url->WriteDocumentDataFinished(); NotifyListener(); }
void CacheFileInputStream::MaybeNotifyListener() { mFile->AssertOwnsLock(); LOG(("CacheFileInputStream::MaybeNotifyListener() [this=%p, mCallback=%p, " "mClosed=%d, mStatus=0x%08x, mChunk=%p, mListeningForChunk=%lld, " "mWaitingForUpdate=%d]", this, mCallback.get(), mClosed, mStatus, mChunk.get(), mListeningForChunk, mWaitingForUpdate)); if (!mCallback) return; if (mClosed || NS_FAILED(mStatus)) { NotifyListener(); return; } if (!mChunk) { if (mListeningForChunk == -1) { // EOF, should we notify even if mCallbackFlags == WAIT_CLOSURE_ONLY ?? NotifyListener(); } return; } MOZ_ASSERT(mPos / kChunkSize == mChunk->Index()); if (mWaitingForUpdate) return; int64_t canRead; const char *buf; CanRead(&canRead, &buf); if (NS_FAILED(mStatus)) { // CanRead() called CloseWithStatusLocked() which called // MaybeNotifyListener() so the listener was already notified. Stop here. MOZ_ASSERT(!mCallback); return; } if (canRead > 0) { if (!(mCallbackFlags & WAIT_CLOSURE_ONLY)) NotifyListener(); } else if (canRead == 0) { if (!mFile->mOutput) { // EOF NotifyListener(); } else { mChunk->WaitForUpdate(this); mWaitingForUpdate = true; } } else { // Output have set EOF before mPos? MOZ_ASSERT(false, "SetEOF is currenty not implemented?!"); NotifyListener(); } }
void TransferItem::PutURLData(const char *data, unsigned int len) { m_url->WriteDocumentData(URL::KNormal, data, len); NotifyListener(); }