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

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

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: Fix leak Created 4 years, 9 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
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // monster's existence. If |store| is NULL, then no backing store will be 137 // monster's existence. If |store| is NULL, then no backing store will be
138 // updated. If |delegate| is non-NULL, it will be notified on 138 // updated. If |delegate| is non-NULL, it will be notified on
139 // creation/deletion of cookies. 139 // creation/deletion of cookies.
140 CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate); 140 CookieMonster(PersistentCookieStore* store, CookieMonsterDelegate* delegate);
141 141
142 // Only used during unit testing. 142 // Only used during unit testing.
143 CookieMonster(PersistentCookieStore* store, 143 CookieMonster(PersistentCookieStore* store,
144 CookieMonsterDelegate* delegate, 144 CookieMonsterDelegate* delegate,
145 int last_access_threshold_milliseconds); 145 int last_access_threshold_milliseconds);
146 146
147 ~CookieMonster() override;
148
147 // Replaces all the cookies by |list|. This method does not flush the backend. 149 // Replaces all the cookies by |list|. This method does not flush the backend.
148 void SetAllCookiesAsync(const CookieList& list, 150 void SetAllCookiesAsync(const CookieList& list,
149 const SetCookiesCallback& callback); 151 const SetCookiesCallback& callback);
150 152
151 // CookieStore implementation. 153 // CookieStore implementation.
152 void SetCookieWithOptionsAsync(const GURL& url, 154 void SetCookieWithOptionsAsync(const GURL& url,
153 const std::string& cookie_line, 155 const std::string& cookie_line,
154 const CookieOptions& options, 156 const CookieOptions& options,
155 const SetCookiesCallback& callback) override; 157 const SetCookiesCallback& callback) override;
156 void SetCookieWithDetailsAsync(const GURL& url, 158 void SetCookieWithDetailsAsync(const GURL& url,
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 kUnknownFetch, 376 kUnknownFetch,
375 }; 377 };
376 378
377 // The number of days since last access that cookies will not be subject 379 // The number of days since last access that cookies will not be subject
378 // to global garbage collection. 380 // to global garbage collection.
379 static const int kSafeFromGlobalPurgeDays; 381 static const int kSafeFromGlobalPurgeDays;
380 382
381 // Record statistics every kRecordStatisticsIntervalSeconds of uptime. 383 // Record statistics every kRecordStatisticsIntervalSeconds of uptime.
382 static const int kRecordStatisticsIntervalSeconds = 10 * 60; 384 static const int kRecordStatisticsIntervalSeconds = 10 * 60;
383 385
384 ~CookieMonster() override;
385
386 // The following are synchronous calls to which the asynchronous methods 386 // The following are synchronous calls to which the asynchronous methods
387 // delegate either immediately (if the store is loaded) or through a deferred 387 // delegate either immediately (if the store is loaded) or through a deferred
388 // task (if the store is not yet loaded). 388 // task (if the store is not yet loaded).
389 bool SetCookieWithDetails(const GURL& url, 389 bool SetCookieWithDetails(const GURL& url,
390 const std::string& name, 390 const std::string& name,
391 const std::string& value, 391 const std::string& value,
392 const std::string& domain, 392 const std::string& domain,
393 const std::string& path, 393 const std::string& path,
394 base::Time creation_time, 394 base::Time creation_time,
395 base::Time expiration_time, 395 base::Time expiration_time,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // Map of domain keys to their associated task queues. These tasks are blocked 672 // Map of domain keys to their associated task queues. These tasks are blocked
673 // until all cookies for the associated domain key eTLD+1 are loaded from the 673 // until all cookies for the associated domain key eTLD+1 are loaded from the
674 // backend store. 674 // backend store.
675 std::map<std::string, std::deque<scoped_refptr<CookieMonsterTask>>> 675 std::map<std::string, std::deque<scoped_refptr<CookieMonsterTask>>>
676 tasks_pending_for_key_; 676 tasks_pending_for_key_;
677 677
678 // Queues tasks that are blocked until all cookies are loaded from the backend 678 // Queues tasks that are blocked until all cookies are loaded from the backend
679 // store. 679 // store.
680 std::queue<scoped_refptr<CookieMonsterTask>> tasks_pending_; 680 std::queue<scoped_refptr<CookieMonsterTask>> tasks_pending_;
681 681
682 scoped_refptr<PersistentCookieStore> store_; 682 scoped_refptr<PersistentCookieStore> store_;
Randy Smith (Not in Mondays) 2016/02/29 22:37:45 Is there a bug somewhere to make this scoped_ptr<>
mmenke 2016/02/29 23:00:29 I don't think there's much value in making it non-
683 683
684 base::Time last_time_seen_; 684 base::Time last_time_seen_;
685 685
686 // Minimum delay after updating a cookie's LastAccessDate before we will 686 // Minimum delay after updating a cookie's LastAccessDate before we will
687 // update it again. 687 // update it again.
688 const base::TimeDelta last_access_threshold_; 688 const base::TimeDelta last_access_threshold_;
689 689
690 // Approximate date of access time of least recently accessed cookie 690 // Approximate date of access time of least recently accessed cookie
691 // in |cookies_|. Note that this is not guaranteed to be accurate, only a) 691 // in |cookies_|. Note that this is not guaranteed to be accurate, only a)
692 // to be before or equal to the actual time, and b) to be accurate 692 // to be before or equal to the actual time, and b) to be accurate
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 virtual ~PersistentCookieStore() {} 806 virtual ~PersistentCookieStore() {}
807 807
808 private: 808 private:
809 friend class base::RefCountedThreadSafe<PersistentCookieStore>; 809 friend class base::RefCountedThreadSafe<PersistentCookieStore>;
810 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); 810 DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore);
811 }; 811 };
812 812
813 } // namespace net 813 } // namespace net
814 814
815 #endif // NET_COOKIES_COOKIE_MONSTER_H_ 815 #endif // NET_COOKIES_COOKIE_MONSTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698