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

Unified Diff: net/cookies/cookie_monster.h

Issue 2971323002: Switch cookie async mechanism over to using callbacks. (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/cookies/cookie_monster.cc » ('j') | net/cookies/cookie_monster.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_monster.h
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 17c5abbf528fe62e4835298c92a9d548df9cc616..581c24ea24f879821dac266d713eaf1f680bacf1 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -51,9 +51,9 @@ class CookieMonsterDelegate;
//
// A cookie task is either pending loading of the entire cookie store, or
// loading of cookies for a specific domain key(eTLD+1). In the former case, the
-// cookie task will be queued in tasks_pending_ while PersistentCookieStore
+// cookie callback will be queued in tasks_pending_ while PersistentCookieStore
// chain loads the cookie store on DB thread. In the latter case, the cookie
-// task will be queued in tasks_pending_for_key_ while PermanentCookieStore
+// callback will be queued in tasks_pending_for_key_ while PermanentCookieStore
// loads cookies for the specified domain key(eTLD+1) on DB thread.
//
// TODO(deanm) Implement CookieMonster, the cookie database.
@@ -234,24 +234,6 @@ class NET_EXPORT CookieMonster : public CookieStore {
ChannelIDService* channel_id_service,
base::TimeDelta last_access_threshold);
- // For queueing the cookie monster calls.
- class CookieMonsterTask;
- template <typename Result>
- class DeleteTask;
- class DeleteAllCreatedBetweenTask;
- class DeleteAllCreatedBetweenWithPredicateTask;
- class DeleteCookieTask;
- class DeleteCanonicalCookieTask;
- class GetCookieListForURLWithOptionsTask;
- class GetAllCookiesTask;
- class GetCookiesWithOptionsTask;
- class GetCookieListWithOptionsTask;
- class SetAllCookiesTask;
- class SetCookieWithDetailsTask;
- class SetCookieWithOptionsTask;
- class SetCanonicalCookieTask;
- class DeleteSessionCookiesTask;
-
// Testing support.
// For SetCookieWithCreationTime.
FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest,
@@ -560,7 +542,7 @@ class NET_EXPORT CookieMonster : public CookieStore {
// Sets all cookies from |list| after deleting any equivalent cookie.
// For data gathering purposes, this routine is treated as if it is
// restoring saved cookies; some statistics are not gathered in this case.
- bool SetAllCookies(const CookieList& list);
+ bool SetAllCookies(CookieList list);
void InternalUpdateCookieAccessTime(CanonicalCookie* cc,
const base::Time& current_time);
@@ -644,14 +626,13 @@ class NET_EXPORT CookieMonster : public CookieStore {
// ugly and increment when we've seen the same time twice.
base::Time CurrentTime();
- // Runs the task if, or defers the task until, the full cookie database is
- // loaded.
- void DoCookieTask(const scoped_refptr<CookieMonsterTask>& task_item);
+ // Runs the callback if, or defers the callback until, the full cookie
+ // database is loaded.
+ void DoCookieCallback(base::OnceClosure callback);
- // Runs the task if, or defers the task until, the cookies for the given URL
- // are loaded.
- void DoCookieTaskForURL(const scoped_refptr<CookieMonsterTask>& task_item,
- const GURL& url);
+ // Runs the callback if, or defers the callback until, the cookies for the
+ // given URL are loaded.
+ void DoCookieCallbackForURL(base::OnceClosure callback, const GURL& url);
// Computes the difference between |old_cookies| and |new_cookies|, and writes
// the result in |cookies_to_add| and |cookies_to_delete|.
@@ -663,10 +644,6 @@ class NET_EXPORT CookieMonster : public CookieStore {
CookieList* cookies_to_add,
CookieList* cookies_to_delete);
- // Runs the given callback. Used to avoid running callbacks after the store
- // has been destroyed.
- void RunCallback(base::OnceClosure callback);
-
// Run all cookie changed callbacks that are monitoring |cookie|.
// |removed| is true if the cookie was deleted.
void RunCookieChangedCallbacks(const CanonicalCookie& cookie,
@@ -701,16 +678,15 @@ class NET_EXPORT CookieMonster : public CookieStore {
// Map of domain keys to their associated task queues. These tasks are blocked
// until all cookies for the associated domain key eTLD+1 are loaded from the
// backend store.
- std::map<std::string, std::deque<scoped_refptr<CookieMonsterTask>>>
- tasks_pending_for_key_;
+ std::map<std::string, std::deque<base::OnceClosure>> tasks_pending_for_key_;
// Queues tasks that are blocked until all cookies are loaded from the backend
// store.
- std::deque<scoped_refptr<CookieMonsterTask>> tasks_pending_;
+ std::deque<base::OnceClosure> tasks_pending_;
// Once a global cookie task has been seen, all per-key tasks must be put in
// |tasks_pending_| instead of |tasks_pending_for_key_| to ensure a reasonable
- // view of the cookie store. This more to ensure fancy cookie export/import
+ // view of the cookie store. This is more to ensure fancy cookie export/import
// code has a consistent view of the CookieStore, rather than out of concern
// for typical use.
bool seen_global_task_;
« 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