Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: net/cookies/cookie_monster.h

Issue 2924933002: Fix CookieMonster garbage collection when no insecure cookies. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/cookies/cookie_monster.cc » ('j') | net/cookies/cookie_monster.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Brought to you by the letter D and the number 2. 5 // Brought to you by the letter D and the number 2.
6 6
7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_ 7 #ifndef NET_COOKIES_COOKIE_MONSTER_H_
8 #define NET_COOKIES_COOKIE_MONSTER_H_ 8 #define NET_COOKIES_COOKIE_MONSTER_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // Testing support. 250 // Testing support.
251 // For SetCookieWithCreationTime. 251 // For SetCookieWithCreationTime.
252 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, 252 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest,
253 TestCookieDeleteAllCreatedBetweenTimestamps); 253 TestCookieDeleteAllCreatedBetweenTimestamps);
254 FRIEND_TEST_ALL_PREFIXES( 254 FRIEND_TEST_ALL_PREFIXES(
255 CookieMonsterTest, 255 CookieMonsterTest,
256 TestCookieDeleteAllCreatedBetweenTimestampsWithPredicate); 256 TestCookieDeleteAllCreatedBetweenTimestampsWithPredicate);
257 257
258 // For garbage collection constants. 258 // For garbage collection constants.
259 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestHostGarbageCollection); 259 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestHostGarbageCollection);
260 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestTotalGarbageCollection);
261 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GarbageCollectionTriggers); 260 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GarbageCollectionTriggers);
261 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest,
262 GarbageCollectWithSecureCookiesOnly);
262 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGCTimes); 263 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGCTimes);
263 264
264 // For validation of key values. 265 // For validation of key values.
265 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestDomainTree); 266 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestDomainTree);
266 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestImport); 267 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestImport);
267 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GetKey); 268 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, GetKey);
268 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGetKey); 269 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, TestGetKey);
269 270
270 // For FindCookiesForKey. 271 // For FindCookiesForKey.
271 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ShortLivedSessionCookies); 272 FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ShortLivedSessionCookies);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 // Helper for GarbageCollect(). Deletes all cookies in the range specified by 599 // Helper for GarbageCollect(). Deletes all cookies in the range specified by
599 // [|it_begin|, |it_end|). Returns the number of cookies deleted. 600 // [|it_begin|, |it_end|). Returns the number of cookies deleted.
600 size_t GarbageCollectDeleteRange(const base::Time& current, 601 size_t GarbageCollectDeleteRange(const base::Time& current,
601 DeletionCause cause, 602 DeletionCause cause,
602 CookieItVector::iterator cookie_its_begin, 603 CookieItVector::iterator cookie_its_begin,
603 CookieItVector::iterator cookie_its_end); 604 CookieItVector::iterator cookie_its_end);
604 605
605 // Helper for GarbageCollect(). Deletes cookies in |cookie_its| from least to 606 // Helper for GarbageCollect(). Deletes cookies in |cookie_its| from least to
606 // most recently used, but only before |safe_date|. Also will stop deleting 607 // most recently used, but only before |safe_date|. Also will stop deleting
607 // when the number of remaining cookies hits |purge_goal|. 608 // when the number of remaining cookies hits |purge_goal|.
609 //
610 // Sets |earliest_time| to be the earliest last access time of a cookie that
611 // was not deleted, or base::Time() if no such cookie exists.
608 size_t GarbageCollectLeastRecentlyAccessed(const base::Time& current, 612 size_t GarbageCollectLeastRecentlyAccessed(const base::Time& current,
609 const base::Time& safe_date, 613 const base::Time& safe_date,
610 size_t purge_goal, 614 size_t purge_goal,
611 CookieItVector cookie_its); 615 CookieItVector cookie_its,
616 base::Time* earliest_time);
612 617
613 // Find the key (for lookup in cookies_) based on the given domain. 618 // Find the key (for lookup in cookies_) based on the given domain.
614 // See comment on keys before the CookieMap typedef. 619 // See comment on keys before the CookieMap typedef.
615 std::string GetKey(const std::string& domain) const; 620 std::string GetKey(const std::string& domain) const;
616 621
617 bool HasCookieableScheme(const GURL& url); 622 bool HasCookieableScheme(const GURL& url);
618 623
619 // Statistics support 624 // Statistics support
620 625
621 // This function should be called repeatedly, and will record 626 // This function should be called repeatedly, and will record
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 virtual ~PersistentCookieStore() {} 821 virtual ~PersistentCookieStore() {}
817 822
818 private: 823 private:
819 friend class base::RefCountedThreadSafe<PersistentCookieStore>; 824 friend class base::RefCountedThreadSafe<PersistentCookieStore>;
820 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 825 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
821 }; 826 };
822 827
823 } // namespace net 828 } // namespace net
824 829
825 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 830 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW
« no previous file with comments | « no previous file | net/cookies/cookie_monster.cc » ('j') | net/cookies/cookie_monster.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698