OLD | NEW |
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // If the number of cookies for CookieMap key |key|, or globally, are | 534 // If the number of cookies for CookieMap key |key|, or globally, are |
535 // over the preset maximums above, garbage collect, first for the host and | 535 // over the preset maximums above, garbage collect, first for the host and |
536 // then globally. See comments above garbage collection threshold | 536 // then globally. See comments above garbage collection threshold |
537 // constants for details. | 537 // constants for details. |
538 // | 538 // |
539 // Returns the number of cookies deleted (useful for debugging). | 539 // Returns the number of cookies deleted (useful for debugging). |
540 size_t GarbageCollect(const base::Time& current, | 540 size_t GarbageCollect(const base::Time& current, |
541 const std::string& key, | 541 const std::string& key, |
542 bool enforce_strict_secure); | 542 bool enforce_strict_secure); |
543 | 543 |
| 544 // Helper for GarbageCollect(). Deletes up to |purge_goal| cookies with a |
| 545 // priority less than or equal to |priority| from |cookies|, while ensuring |
| 546 // that at least the |to_protect| most-recent cookies are retained. |
| 547 // |
| 548 // |cookies| must be sorted from least-recent to most-recent. |
| 549 // |
| 550 // |safe_date| is only used to determine the deletion cause for histograms. |
| 551 // |
| 552 // Returns the number of cookies deleted. |
| 553 size_t PurgeLeastRecentMatches(CookieItVector* cookies, |
| 554 CookiePriority priority, |
| 555 size_t to_protect, |
| 556 size_t purge_goal, |
| 557 const base::Time& safe_date); |
| 558 |
544 // Helper for GarbageCollect(); can be called directly as well. Deletes all | 559 // Helper for GarbageCollect(); can be called directly as well. Deletes all |
545 // expired cookies in |itpair|. If |cookie_its| is non-NULL, all the | 560 // expired cookies in |itpair|. If |cookie_its| is non-NULL, all the |
546 // non-expired cookies from |itpair| are appended to |cookie_its|. | 561 // non-expired cookies from |itpair| are appended to |cookie_its|. |
547 // | 562 // |
548 // Returns the number of cookies deleted. | 563 // Returns the number of cookies deleted. |
549 size_t GarbageCollectExpired(const base::Time& current, | 564 size_t GarbageCollectExpired(const base::Time& current, |
550 const CookieMapItPair& itpair, | 565 const CookieMapItPair& itpair, |
551 CookieItVector* cookie_its); | 566 CookieItVector* cookie_its); |
552 | 567 |
553 // Helper for GarbageCollect(). Deletes all cookies not marked Secure in | 568 // Helper for GarbageCollect(). Deletes all cookies not marked Secure in |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 virtual ~PersistentCookieStore() {} | 805 virtual ~PersistentCookieStore() {} |
791 | 806 |
792 private: | 807 private: |
793 friend class base::RefCountedThreadSafe<PersistentCookieStore>; | 808 friend class base::RefCountedThreadSafe<PersistentCookieStore>; |
794 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); | 809 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); |
795 }; | 810 }; |
796 | 811 |
797 } // namespace net | 812 } // namespace net |
798 | 813 |
799 #endif // NET_COOKIES_COOKIE_MONSTER_H_ | 814 #endif // NET_COOKIES_COOKIE_MONSTER_H_ |
OLD | NEW |