/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
NS_IMETHODIMP
CacheFileOutputStream::Flush() { // TODO do we need to implement flush ???
LOG(("CacheFileOutputStream::Flush() [this=%p]", this)); return NS_OK;
}
NS_IMETHODIMP
CacheFileOutputStream::StreamStatus() {
CacheFileAutoLock lock(mFile);
mFile->AssertOwnsLock(); // For thread-safety analysis
// We use 64-bit offset when accessing the file, unfortunately we use 32-bit // metadata offset, so we cannot handle data bigger than 4GB. if (mPos + aCount > PR_UINT32_MAX) {
LOG(("CacheFileOutputStream::Write() - Entry's size exceeds 4GB. [this=%p]", this));
NS_IMETHODIMP
CacheFileOutputStream::SetEOF() {
MOZ_ASSERT(false, "CacheFileOutputStream::SetEOF() not implemented"); // Right now we don't use SetEOF(). If we ever need this method, we need // to think about what to do with input streams that already points beyond // new EOF. return NS_ERROR_NOT_IMPLEMENTED;
}
// CacheFileChunkListener
nsresult CacheFileOutputStream::OnChunkRead(nsresult aResult,
CacheFileChunk* aChunk) {
MOZ_CRASH("CacheFileOutputStream::OnChunkRead should not be called!"); return NS_ERROR_UNEXPECTED;
}
nsresult CacheFileOutputStream::OnChunkWritten(nsresult aResult,
CacheFileChunk* aChunk) {
MOZ_CRASH("CacheFileOutputStream::OnChunkWritten should not be called!"); return NS_ERROR_UNEXPECTED;
}
nsresult CacheFileOutputStream::OnChunkAvailable(nsresult aResult,
uint32_t aChunkIdx,
CacheFileChunk* aChunk) {
MOZ_CRASH("CacheFileOutputStream::OnChunkAvailable should not be called!"); return NS_ERROR_UNEXPECTED;
}
nsresult CacheFileOutputStream::OnChunkUpdated(CacheFileChunk* aChunk) {
MOZ_CRASH("CacheFileOutputStream::OnChunkUpdated should not be called!"); return NS_ERROR_UNEXPECTED;
}
void CacheFileOutputStream::NotifyCloseListener() {
RefPtr<CacheOutputCloseListener> listener;
listener.swap(mCloseListener); if (!listener) return;
// If the chunk didn't write any data we need to remove hash for this chunk // that was added when the chunk was created in CacheFile::GetChunkLocked. if (mChunk->DataSize() == 0) { // It must be due to a failure, we don't create a new chunk when we don't // have data to write.
MOZ_ASSERT(NS_FAILED(mChunk->GetStatus()));
mFile->mMetadata->RemoveHash(mChunk->Index());
}
if (mChunk) { if (mChunk->Index() == chunkIdx) { // we have a correct chunk
LOG(
("CacheFileOutputStream::EnsureCorrectChunk() - Have correct chunk " "[this=%p, idx=%d]", this, chunkIdx));
if (!mCallbackTarget) {
mCallbackTarget = CacheFileIOManager::IOTarget(); if (!mCallbackTarget) {
LOG(
("CacheFileOutputStream::NotifyListener() - Cannot get Cache I/O " "thread! Using main thread for callback."));
mCallbackTarget = GetMainThreadSerialEventTarget();
}
}
size_t CacheFileOutputStream::SizeOfIncludingThis(
mozilla::MallocSizeOf mallocSizeOf) const { // Everything the stream keeps a reference to is already reported somewhere // else. // mFile reports itself. // mChunk reported as part of CacheFile. // mCloseListener is CacheEntry, already reported. // mCallback is usually CacheFile or a class that is reported elsewhere. return mallocSizeOf(this);
}
} // namespace mozilla::net
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.