From 65781e9b7461c629639f5b9bff4f886b8b033a2b Mon Sep 17 00:00:00 2001 From: "rdsmith@google.com" Date: Wed, 21 Jul 2010 15:29:57 +0000 Subject: Changed type CookieList to being a vector CanonicalCookies. Originally, it was a vector of pair. TEST=Refactor; all relevant unit tests should still pass. BUG=8850 Review URL: http://codereview.chromium.org/2799057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53184 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/cookie_monster.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'net/base/cookie_monster.cc') diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index 183ca96..e79cf47 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -268,11 +268,11 @@ int CookieMonster::TrimDuplicateCookiesForHost( CookieMap::iterator end) { lock_.AssertAcquired(); - // List of cookies ordered by creation time. - typedef std::set CookieList; + // Set of cookies ordered by creation time. + typedef std::set CookieSet; // Helper map we populate to find the duplicates. - typedef std::map EquivalenceMap; + typedef std::map EquivalenceMap; EquivalenceMap equivalent_cookies; // The number of duplicate cookies that have been found. @@ -286,7 +286,7 @@ int CookieMonster::TrimDuplicateCookiesForHost( CookieSignature signature(cookie->Name(), cookie->Domain(), cookie->Path()); - CookieList& list = equivalent_cookies[signature]; + CookieSet& list = equivalent_cookies[signature]; // We found a duplicate! if (!list.empty()) @@ -307,7 +307,7 @@ int CookieMonster::TrimDuplicateCookiesForHost( it != equivalent_cookies.end(); ++it) { const CookieSignature& signature = it->first; - CookieList& dupes = it->second; + CookieSet& dupes = it->second; if (dupes.size() <= 1) continue; // This cookiename/path has no duplicates. @@ -327,7 +327,7 @@ int CookieMonster::TrimDuplicateCookiesForHost( // Remove all the cookies identified by |dupes|. It is valid to delete our // list of iterators one at a time, since |cookies_| is a multimap (they // don't invalidate existing iterators following deletion). - for (CookieList::iterator dupes_it = dupes.begin(); + for (CookieSet::iterator dupes_it = dupes.begin(); dupes_it != dupes.end(); ++dupes_it) { InternalDeleteCookie(*dupes_it, true /*sync_to_store*/, @@ -775,7 +775,7 @@ void CookieMonster::InternalInsertCookie(const std::string& key, store_->AddCookie(key, *cc); cookies_.insert(CookieMap::value_type(key, cc)); if (delegate_.get()) - delegate_->OnCookieChanged(key, *cc, false); + delegate_->OnCookieChanged(*cc, false); } void CookieMonster::InternalUpdateCookieAccessTime(CanonicalCookie* cc) { @@ -811,7 +811,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it, if (cc->IsPersistent() && store_ && sync_to_store) store_->DeleteCookie(*cc); if (delegate_.get()) - delegate_->OnCookieChanged(it->first, *cc, true); + delegate_->OnCookieChanged(*cc, true); cookies_.erase(it); delete cc; } @@ -1129,7 +1129,7 @@ CookieMonster::CookieList CookieMonster::GetAllCookies() { CookieList cookie_list; for (CookieMap::iterator it = cookies_.begin(); it != cookies_.end(); ++it) - cookie_list.push_back(CookieListPair(it->first, *it->second)); + cookie_list.push_back(*it->second); return cookie_list; } @@ -1231,7 +1231,7 @@ void CookieMonster::FindRawCookies(const std::string& key, continue; if (!cc->IsOnPath(path)) continue; - list->push_back(CookieListPair(key, *cc)); + list->push_back(*cc); } } @@ -1682,3 +1682,4 @@ std::string CookieMonster::CanonicalCookie::DebugString() const { } } // namespace + -- cgit v1.1