nsresult CacheIndexIterator::Close() { LOG(("CacheIndexIterator::Close() [this=%p]", this)); CacheIndexAutoLock lock(mIndex); return CloseInternal(NS_ERROR_NOT_AVAILABLE); }
void IDBDatabase::InvalidateInternal() { AssertIsOnOwningThread(); InvalidateMutableFiles(); AbortTransactions(/* aShouldWarn */ true); CloseInternal(); }
NS_IMETHODIMP IDBDatabase::Close() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); CloseInternal(false); NS_ASSERTION(mClosed, "Should have set the closed flag!"); return NS_OK; }
IDBDatabase::~IDBDatabase() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); if (mRegistered) { CloseInternal(true); IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get(); if (mgr) { mgr->UnregisterDatabase(this); } } }
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Close_Locked() { nsresult rv = EnsureInit(); if (NS_SUCCEEDED(rv)) { rv = mInput->Close(); } else { NS_ASSERTION(!mInput, "Shouldn't have mInput when EnsureInit() failed"); } // Call CloseInternal() even when EnsureInit() failed, e.g. in case we are // closing streams with nsCacheService::CloseAllStream() CloseInternal(); return rv; }
void IDBDatabase::OnUnlink() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!mOwner, "Should have been cleared already!"); // We've been unlinked, at the very least we should be able to prevent further // transactions from starting and unblock any other SetVersion callers. CloseInternal(true); // No reason for the IndexedDatabaseManager to track us any longer. IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get(); if (mgr) { mgr->UnregisterDatabase(this); // Don't try to unregister again in the destructor. mRegistered = false; } }
nsresult CacheIndexIterator::GetNextHash(SHA1Sum::Hash *aHash) { LOG(("CacheIndexIterator::GetNextHash() [this=%p]", this)); CacheIndexAutoLock lock(mIndex); if (NS_FAILED(mStatus)) { return mStatus; } if (!mRecords.Length()) { CloseInternal(NS_ERROR_NOT_AVAILABLE); return mStatus; } memcpy(aHash, mRecords[mRecords.Length() - 1]->mHash, sizeof(SHA1Sum::Hash)); mRecords.RemoveElementAt(mRecords.Length() - 1); return NS_OK; }