BNetworkCookieJar::~BNetworkCookieJar() { BNetworkCookie* cookiePtr; for (Iterator it = GetIterator(); (cookiePtr = it.Next()) != NULL;) delete it.Remove(); }
uint32 BNetworkCookieJar::PurgeForExit() { int32 deleteCount = 0; const BNetworkCookie* cookiePtr; for (Iterator it = GetIterator(); (cookiePtr = it.Next()) != NULL;) { if (cookiePtr->ShouldDeleteAtExit()) { delete it.Remove(); deleteCount++; } } return deleteCount; }
uint32 BNetworkCookieJar::DeleteOutdatedCookies() { int32 deleteCount = 0; const BNetworkCookie* cookiePtr; for (Iterator it = GetIterator(); (cookiePtr = it.Next()) != NULL;) { if (cookiePtr->ShouldDeleteNow()) { delete it.Remove(); deleteCount++; } } return deleteCount; }
BNetworkCookieJar::~BNetworkCookieJar() { for (Iterator it = GetIterator(); it.Next() != NULL;) { delete it.Remove(); } fCookieHashMap->Lock(); PrivateHashMap::Iterator it = fCookieHashMap->GetIterator(); while(it.HasNext()) { BNetworkCookieList* list = *it.NextValue(); it.Remove(); list->LockForWriting(); delete list; } delete fCookieHashMap; }
BNetworkCookieJar& BNetworkCookieJar::operator=(const BNetworkCookieJar& other) { if (&other == this) return *this; for (Iterator it = GetIterator(); it.Next() != NULL;) delete it.Remove(); BArchivable::operator=(other); BFlattenable::operator=(other); fFlattened = other.fFlattened; delete fCookieHashMap; fCookieHashMap = new(std::nothrow) PrivateHashMap(); for (Iterator it = other.GetIterator(); it.HasNext();) { const BNetworkCookie* cookie = it.Next(); AddCookie(*cookie); // Pass by reference so the cookie is copied. } return *this; }