Index: net/base/cookie_monster.h |
=================================================================== |
--- net/base/cookie_monster.h (revision 100935) |
+++ net/base/cookie_monster.h (working copy) |
@@ -10,6 +10,7 @@ |
#include <map> |
#include <queue> |
+#include <set> |
#include <string> |
#include <utility> |
#include <vector> |
@@ -450,9 +451,17 @@ |
// Stores cookies loaded from the backing store and invokes any deferred |
// calls. |beginning_time| should be the moment PersistentCookieStore::Load |
// was invoked and is used for reporting histogram_time_load_. |
+ // See PersistentCookieStore::Load for details on the contents of cookies. |
erikwright (departed)
2011/09/16 18:58:57
The comments I asked for apply to the interface co
guohui
2011/09/16 19:31:50
Done.
|
void OnLoaded(base::TimeTicks beginning_time, |
const std::vector<CanonicalCookie*>& cookies); |
+ // Stores cookies loaded from the backing store and invokes deferred callback. |
+ // Called when all cookies for the domain key(eTLD+1) has been loaded from DB. |
+ // See PersistentCookieStore::Load for details on the contents of cookies. |
+ void CookieMonster::OnKeyLoaded( |
+ const base::Closure& request_task, const std::string& key, |
+ const std::vector<CanonicalCookie*>& cookies); |
+ |
// Stores the loaded cookies. |
void StoreLoadedCookies(const std::vector<CanonicalCookie*>& cookies); |
@@ -568,10 +577,15 @@ |
// ugly and increment when we've seen the same time twice. |
base::Time CurrentTime(); |
- // Run the cookie request task if cookie loaded, otherwise added the task |
- // to task queue. |
+ // Runs the task if, or defers the task until, |
erikwright (departed)
2011/09/16 18:58:57
Correct line wrapping to 80 columns.
guohui
2011/09/16 19:31:50
Done.
|
+ // the full cookie database is loaded. |
void DoCookieTask(const scoped_refptr<CookieMonsterTask>& task_item); |
+ // Runs the task if, or defers the task until, |
erikwright (departed)
2011/09/16 18:58:57
Line wrapping.
guohui
2011/09/16 19:31:50
Done.
|
+ // the cookies for the given URL are loaded. |
+ void DoCookieTask(const scoped_refptr<CookieMonsterTask>& task_item, |
+ const GURL& url); |
+ |
// Histogram variables; see CookieMonster::InitializeHistograms() in |
// cookie_monster.cc for details. |
base::Histogram* histogram_expiration_duration_minutes_; |
@@ -597,6 +611,9 @@ |
// calls may be immediately processed. |
bool loaded_; |
+ // List of domain keys that have been loaded from DB |
+ std::set<std::string> keys_loaded_; |
+ |
// Queues calls to CookieMonster until loading from the backend store is |
// completed. |
std::queue<scoped_refptr<CookieMonsterTask> > queue_; |
@@ -620,10 +637,15 @@ |
// This value is used to determine whether global garbage collection might |
// find cookies to purge. |
// Note: The default Time() constructor will create a value that compares |
- // earlier than any other time value, which is is wanted. Thus this |
+ // earlier than any other time value, which is wanted. Thus this |
// value is not initialized. |
base::Time earliest_access_time_; |
+ // Avoid ever letting cookies with duplicate creation times into the store; |
erikwright (departed)
2011/09/16 18:58:57
"During loading, holds the set of all loaded cooki
guohui
2011/09/16 19:31:50
Done.
|
+ // that way we don't have to worry about what sections of code are safe |
+ // to call while it's in that state. |
+ std::set<int64> creation_times; |
erikwright (departed)
2011/09/16 18:58:57
Suffix with a '_'.
guohui
2011/09/16 19:31:50
Done.
|
+ |
std::vector<std::string> cookieable_schemes_; |
scoped_refptr<Delegate> delegate_; |
@@ -920,8 +942,12 @@ |
// Initializes the store and retrieves the existing cookies. This will be |
// called only once at startup. |
- virtual bool Load(const LoadedCallback& loaded_callback) = 0; |
+ virtual void Load(const LoadedCallback& loaded_callback) = 0; |
+ // Load all cookies for a domain key(eTLD+1). |
+ virtual void LoadCookiesForKey(const std::string& key, |
+ const LoadedCallback& loaded_callback) = 0; |
+ |
virtual void AddCookie(const CanonicalCookie& cc) = 0; |
virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0; |
virtual void DeleteCookie(const CanonicalCookie& cc) = 0; |