OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Portions of this code based on Mozilla: | 5 // Portions of this code based on Mozilla: |
6 // (netwerk/cookie/src/nsCookieService.cpp) | 6 // (netwerk/cookie/src/nsCookieService.cpp) |
7 /* ***** BEGIN LICENSE BLOCK ***** | 7 /* ***** BEGIN LICENSE BLOCK ***** |
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
9 * | 9 * |
10 * The contents of this file are subject to the Mozilla Public License Version | 10 * The contents of this file are subject to the Mozilla Public License Version |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 * | 42 * |
43 * ***** END LICENSE BLOCK ***** */ | 43 * ***** END LICENSE BLOCK ***** */ |
44 | 44 |
45 #include "net/base/cookie_monster.h" | 45 #include "net/base/cookie_monster.h" |
46 | 46 |
47 #include <algorithm> | 47 #include <algorithm> |
48 #include <set> | 48 #include <set> |
49 | 49 |
50 #include "base/basictypes.h" | 50 #include "base/basictypes.h" |
51 #include "base/bind.h" | 51 #include "base/bind.h" |
| 52 #include "base/callback.h" |
52 #include "base/format_macros.h" | 53 #include "base/format_macros.h" |
53 #include "base/logging.h" | 54 #include "base/logging.h" |
54 #include "base/memory/scoped_ptr.h" | 55 #include "base/memory/scoped_ptr.h" |
55 #include "base/message_loop.h" | 56 #include "base/message_loop.h" |
56 #include "base/message_loop_proxy.h" | 57 #include "base/message_loop_proxy.h" |
57 #include "base/metrics/histogram.h" | 58 #include "base/metrics/histogram.h" |
58 #include "base/string_tokenizer.h" | 59 #include "base/string_tokenizer.h" |
59 #include "base/string_util.h" | 60 #include "base/string_util.h" |
60 #include "base/stringprintf.h" | 61 #include "base/stringprintf.h" |
61 #include "googleurl/src/gurl.h" | 62 #include "googleurl/src/gurl.h" |
62 #include "googleurl/src/url_canon.h" | 63 #include "googleurl/src/url_canon.h" |
63 #include "net/base/net_util.h" | 64 #include "net/base/net_util.h" |
64 #include "net/base/registry_controlled_domain.h" | 65 #include "net/base/registry_controlled_domain.h" |
65 | 66 |
66 using base::Time; | 67 using base::Time; |
67 using base::TimeDelta; | 68 using base::TimeDelta; |
68 using base::TimeTicks; | 69 using base::TimeTicks; |
69 | 70 |
| 71 // In steady state, most cookie requests can be satisfied by the in memory |
| 72 // cookie monster store. However, if a request comes in during the initial |
| 73 // cookie load, it must be delayed until that load completes. That is done by |
| 74 // queueing it on CookieMonster::queue_ and running it when notification of |
| 75 // cookie load completion is received via CookieMonster::OnLoaded. This callback |
| 76 // is passed to the persistent store from CookieMonster::InitStore(), which is |
| 77 // called on the first operation invoked on the CookieMonster. |
| 78 // |
| 79 // On the browser critical paths (e.g. for loading initial web pages in a |
| 80 // session restore) it may take too long to wait for the full load. If a cookie |
| 81 // request is for a specific URL, DoCookieTaskForURL is called, which triggers a |
| 82 // priority load if the key is not loaded yet by calling PersistentCookieStore |
| 83 // :: LoadCookiesForKey. The request is queued in CookieMonster::tasks_queued |
| 84 // and executed upon receiving notification of key load completion via |
| 85 // CookieMonster::OnKeyLoaded(). If multiple requests for the same eTLD+1 are |
| 86 // received before key load completion, only the first request calls |
| 87 // PersistentCookieStore::LoadCookiesForKey, all subsequent requests are queued |
| 88 // in CookieMonster::tasks_queued and executed upon receiving notification of |
| 89 // key load completion triggered by the first request for the same eTLD+1. |
| 90 |
70 static const int kMinutesInTenYears = 10 * 365 * 24 * 60; | 91 static const int kMinutesInTenYears = 10 * 365 * 24 * 60; |
71 | 92 |
72 namespace net { | 93 namespace net { |
73 | 94 |
74 // See comments at declaration of these variables in cookie_monster.h | 95 // See comments at declaration of these variables in cookie_monster.h |
75 // for details. | 96 // for details. |
76 const size_t CookieMonster::kDomainMaxCookies = 180; | 97 const size_t CookieMonster::kDomainMaxCookies = 180; |
77 const size_t CookieMonster::kDomainPurgeCookies = 30; | 98 const size_t CookieMonster::kDomainPurgeCookies = 30; |
78 const size_t CookieMonster::kMaxCookies = 3300; | 99 const size_t CookieMonster::kMaxCookies = 3300; |
79 const size_t CookieMonster::kPurgeCookies = 300; | 100 const size_t CookieMonster::kPurgeCookies = 300; |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 void CookieMonster::SetCookieWithDetailsAsync( | 1007 void CookieMonster::SetCookieWithDetailsAsync( |
987 const GURL& url, const std::string& name, const std::string& value, | 1008 const GURL& url, const std::string& name, const std::string& value, |
988 const std::string& domain, const std::string& path, | 1009 const std::string& domain, const std::string& path, |
989 const base::Time& expiration_time, bool secure, bool http_only, | 1010 const base::Time& expiration_time, bool secure, bool http_only, |
990 const SetCookiesCallback& callback) { | 1011 const SetCookiesCallback& callback) { |
991 scoped_refptr<SetCookieWithDetailsTask> task = | 1012 scoped_refptr<SetCookieWithDetailsTask> task = |
992 new SetCookieWithDetailsTask(this, url, name, value, domain, path, | 1013 new SetCookieWithDetailsTask(this, url, name, value, domain, path, |
993 expiration_time, secure, http_only, | 1014 expiration_time, secure, http_only, |
994 callback); | 1015 callback); |
995 | 1016 |
996 DoCookieTask(task); | 1017 DoCookieTaskForURL(task, url); |
997 } | 1018 } |
998 | 1019 |
999 void CookieMonster::GetAllCookiesAsync(const GetCookieListCallback& callback) { | 1020 void CookieMonster::GetAllCookiesAsync(const GetCookieListCallback& callback) { |
1000 scoped_refptr<GetAllCookiesTask> task = | 1021 scoped_refptr<GetAllCookiesTask> task = |
1001 new GetAllCookiesTask(this, callback); | 1022 new GetAllCookiesTask(this, callback); |
1002 | 1023 |
1003 DoCookieTask(task); | 1024 DoCookieTask(task); |
1004 } | 1025 } |
1005 | 1026 |
1006 | 1027 |
1007 void CookieMonster::GetAllCookiesForURLWithOptionsAsync( | 1028 void CookieMonster::GetAllCookiesForURLWithOptionsAsync( |
1008 const GURL& url, | 1029 const GURL& url, |
1009 const CookieOptions& options, | 1030 const CookieOptions& options, |
1010 const GetCookieListCallback& callback) { | 1031 const GetCookieListCallback& callback) { |
1011 scoped_refptr<GetAllCookiesForURLWithOptionsTask> task = | 1032 scoped_refptr<GetAllCookiesForURLWithOptionsTask> task = |
1012 new GetAllCookiesForURLWithOptionsTask(this, url, options, callback); | 1033 new GetAllCookiesForURLWithOptionsTask(this, url, options, callback); |
1013 | 1034 |
1014 DoCookieTask(task); | 1035 DoCookieTaskForURL(task, url); |
1015 } | 1036 } |
1016 | 1037 |
1017 void CookieMonster::GetAllCookiesForURLAsync( | 1038 void CookieMonster::GetAllCookiesForURLAsync( |
1018 const GURL& url, const GetCookieListCallback& callback) { | 1039 const GURL& url, const GetCookieListCallback& callback) { |
1019 CookieOptions options; | 1040 CookieOptions options; |
1020 options.set_include_httponly(); | 1041 options.set_include_httponly(); |
1021 scoped_refptr<GetAllCookiesForURLWithOptionsTask> task = | 1042 scoped_refptr<GetAllCookiesForURLWithOptionsTask> task = |
1022 new GetAllCookiesForURLWithOptionsTask(this, url, options, callback); | 1043 new GetAllCookiesForURLWithOptionsTask(this, url, options, callback); |
1023 | 1044 |
1024 DoCookieTask(task); | 1045 DoCookieTaskForURL(task, url); |
1025 } | 1046 } |
1026 | 1047 |
1027 void CookieMonster::DeleteAllAsync(const DeleteCallback& callback) { | 1048 void CookieMonster::DeleteAllAsync(const DeleteCallback& callback) { |
1028 scoped_refptr<DeleteAllTask> task = | 1049 scoped_refptr<DeleteAllTask> task = |
1029 new DeleteAllTask(this, callback); | 1050 new DeleteAllTask(this, callback); |
1030 | 1051 |
1031 DoCookieTask(task); | 1052 DoCookieTask(task); |
1032 } | 1053 } |
1033 | 1054 |
1034 void CookieMonster::DeleteAllCreatedBetweenAsync( | 1055 void CookieMonster::DeleteAllCreatedBetweenAsync( |
1035 const Time& delete_begin, const Time& delete_end, | 1056 const Time& delete_begin, const Time& delete_end, |
1036 const DeleteCallback& callback) { | 1057 const DeleteCallback& callback) { |
1037 scoped_refptr<DeleteAllCreatedBetweenTask> task = | 1058 scoped_refptr<DeleteAllCreatedBetweenTask> task = |
1038 new DeleteAllCreatedBetweenTask(this, delete_begin, delete_end, | 1059 new DeleteAllCreatedBetweenTask(this, delete_begin, delete_end, |
1039 callback); | 1060 callback); |
1040 | 1061 |
1041 DoCookieTask(task); | 1062 DoCookieTask(task); |
1042 } | 1063 } |
1043 | 1064 |
1044 void CookieMonster::DeleteAllForHostAsync( | 1065 void CookieMonster::DeleteAllForHostAsync( |
1045 const GURL& url, const DeleteCallback& callback) { | 1066 const GURL& url, const DeleteCallback& callback) { |
1046 scoped_refptr<DeleteAllForHostTask> task = | 1067 scoped_refptr<DeleteAllForHostTask> task = |
1047 new DeleteAllForHostTask(this, url, callback); | 1068 new DeleteAllForHostTask(this, url, callback); |
1048 | 1069 |
1049 DoCookieTask(task); | 1070 DoCookieTaskForURL(task, url); |
1050 } | 1071 } |
1051 | 1072 |
1052 void CookieMonster::DeleteCanonicalCookieAsync( | 1073 void CookieMonster::DeleteCanonicalCookieAsync( |
1053 const CanonicalCookie& cookie, | 1074 const CanonicalCookie& cookie, |
1054 const DeleteCookieCallback& callback) { | 1075 const DeleteCookieCallback& callback) { |
1055 scoped_refptr<DeleteCanonicalCookieTask> task = | 1076 scoped_refptr<DeleteCanonicalCookieTask> task = |
1056 new DeleteCanonicalCookieTask(this, cookie, callback); | 1077 new DeleteCanonicalCookieTask(this, cookie, callback); |
1057 | 1078 |
1058 DoCookieTask(task); | 1079 DoCookieTask(task); |
1059 } | 1080 } |
1060 | 1081 |
1061 void CookieMonster::SetCookieWithOptionsAsync( | 1082 void CookieMonster::SetCookieWithOptionsAsync( |
1062 const GURL& url, | 1083 const GURL& url, |
1063 const std::string& cookie_line, | 1084 const std::string& cookie_line, |
1064 const CookieOptions& options, | 1085 const CookieOptions& options, |
1065 const SetCookiesCallback& callback) { | 1086 const SetCookiesCallback& callback) { |
1066 scoped_refptr<SetCookieWithOptionsTask> task = | 1087 scoped_refptr<SetCookieWithOptionsTask> task = |
1067 new SetCookieWithOptionsTask(this, url, cookie_line, options, callback); | 1088 new SetCookieWithOptionsTask(this, url, cookie_line, options, callback); |
1068 | 1089 |
1069 DoCookieTask(task); | 1090 DoCookieTaskForURL(task, url); |
1070 } | 1091 } |
1071 | 1092 |
1072 void CookieMonster::GetCookiesWithOptionsAsync( | 1093 void CookieMonster::GetCookiesWithOptionsAsync( |
1073 const GURL& url, | 1094 const GURL& url, |
1074 const CookieOptions& options, | 1095 const CookieOptions& options, |
1075 const GetCookiesCallback& callback) { | 1096 const GetCookiesCallback& callback) { |
1076 scoped_refptr<GetCookiesWithOptionsTask> task = | 1097 scoped_refptr<GetCookiesWithOptionsTask> task = |
1077 new GetCookiesWithOptionsTask(this, url, options, callback); | 1098 new GetCookiesWithOptionsTask(this, url, options, callback); |
1078 | 1099 |
1079 DoCookieTask(task); | 1100 DoCookieTaskForURL(task, url); |
1080 } | 1101 } |
1081 | 1102 |
1082 void CookieMonster::GetCookiesWithInfoAsync( | 1103 void CookieMonster::GetCookiesWithInfoAsync( |
1083 const GURL& url, | 1104 const GURL& url, |
1084 const CookieOptions& options, | 1105 const CookieOptions& options, |
1085 const GetCookieInfoCallback& callback) { | 1106 const GetCookieInfoCallback& callback) { |
1086 scoped_refptr<GetCookiesWithInfoTask> task = | 1107 scoped_refptr<GetCookiesWithInfoTask> task = |
1087 new GetCookiesWithInfoTask(this, url, options, callback); | 1108 new GetCookiesWithInfoTask(this, url, options, callback); |
1088 | 1109 |
1089 DoCookieTask(task); | 1110 DoCookieTaskForURL(task, url); |
1090 } | 1111 } |
1091 | 1112 |
1092 void CookieMonster::DeleteCookieAsync(const GURL& url, | 1113 void CookieMonster::DeleteCookieAsync(const GURL& url, |
1093 const std::string& cookie_name, | 1114 const std::string& cookie_name, |
1094 const base::Closure& callback) { | 1115 const base::Closure& callback) { |
1095 scoped_refptr<DeleteCookieTask> task = | 1116 scoped_refptr<DeleteCookieTask> task = |
1096 new DeleteCookieTask(this, url, cookie_name, callback); | 1117 new DeleteCookieTask(this, url, cookie_name, callback); |
1097 | 1118 |
1098 DoCookieTask(task); | 1119 DoCookieTaskForURL(task, url); |
1099 } | 1120 } |
1100 | 1121 |
1101 void CookieMonster::DoCookieTask( | 1122 void CookieMonster::DoCookieTask( |
1102 const scoped_refptr<CookieMonsterTask>& task_item) { | 1123 const scoped_refptr<CookieMonsterTask>& task_item) { |
1103 InitIfNecessary(); | |
1104 | |
1105 { | 1124 { |
1106 base::AutoLock autolock(lock_); | 1125 base::AutoLock autolock(lock_); |
| 1126 InitIfNecessary(); |
1107 if (!loaded_) { | 1127 if (!loaded_) { |
1108 queue_.push(task_item); | 1128 queue_.push(task_item); |
1109 return; | 1129 return; |
1110 } | 1130 } |
1111 } | 1131 } |
1112 | 1132 |
1113 task_item->Run(); | 1133 task_item->Run(); |
1114 } | 1134 } |
1115 | 1135 |
| 1136 void CookieMonster::DoCookieTaskForURL( |
| 1137 const scoped_refptr<CookieMonsterTask>& task_item, |
| 1138 const GURL& url) { |
| 1139 { |
| 1140 base::AutoLock autolock(lock_); |
| 1141 InitIfNecessary(); |
| 1142 // If cookies for the requested domain key (eTLD+1) have been loaded from DB |
| 1143 // then run the task, otherwise load from DB. |
| 1144 if (!loaded_) { |
| 1145 // Checks if the domain key has been loaded. |
| 1146 std::string key(GetEffectiveDomain(url.scheme(), url.host())); |
| 1147 if (keys_loaded_.find(key) == keys_loaded_.end()) { |
| 1148 std::map<std::string, std::deque<scoped_refptr<CookieMonsterTask> > > |
| 1149 ::iterator it = tasks_queued_.find(key); |
| 1150 if (it == tasks_queued_.end()) { |
| 1151 store_->LoadCookiesForKey(key, |
| 1152 base::Bind(&CookieMonster::OnKeyLoaded, this, key)); |
| 1153 it = tasks_queued_.insert(std::make_pair(key, |
| 1154 std::deque<scoped_refptr<CookieMonsterTask> >())).first; |
| 1155 } |
| 1156 it->second.push_back(task_item); |
| 1157 return; |
| 1158 } |
| 1159 } |
| 1160 } |
| 1161 task_item->Run(); |
| 1162 } |
| 1163 |
1116 bool CookieMonster::SetCookieWithDetails( | 1164 bool CookieMonster::SetCookieWithDetails( |
1117 const GURL& url, const std::string& name, const std::string& value, | 1165 const GURL& url, const std::string& name, const std::string& value, |
1118 const std::string& domain, const std::string& path, | 1166 const std::string& domain, const std::string& path, |
1119 const base::Time& expiration_time, bool secure, bool http_only) { | 1167 const base::Time& expiration_time, bool secure, bool http_only) { |
1120 base::AutoLock autolock(lock_); | 1168 base::AutoLock autolock(lock_); |
1121 | 1169 |
1122 if (!HasCookieableScheme(url)) | 1170 if (!HasCookieableScheme(url)) |
1123 return false; | 1171 return false; |
1124 | 1172 |
1125 Time creation_time = CurrentTime(); | 1173 Time creation_time = CurrentTime(); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 | 1511 |
1464 void CookieMonster::OnLoaded(TimeTicks beginning_time, | 1512 void CookieMonster::OnLoaded(TimeTicks beginning_time, |
1465 const std::vector<CanonicalCookie*>& cookies) { | 1513 const std::vector<CanonicalCookie*>& cookies) { |
1466 StoreLoadedCookies(cookies); | 1514 StoreLoadedCookies(cookies); |
1467 histogram_time_load_->AddTime(TimeTicks::Now() - beginning_time); | 1515 histogram_time_load_->AddTime(TimeTicks::Now() - beginning_time); |
1468 | 1516 |
1469 // Invoke the task queue of cookie request. | 1517 // Invoke the task queue of cookie request. |
1470 InvokeQueue(); | 1518 InvokeQueue(); |
1471 } | 1519 } |
1472 | 1520 |
| 1521 void CookieMonster::OnKeyLoaded(const std::string& key, |
| 1522 const std::vector<CanonicalCookie*>& cookies) { |
| 1523 // This function does its own separate locking. |
| 1524 StoreLoadedCookies(cookies); |
| 1525 |
| 1526 std::deque<scoped_refptr<CookieMonsterTask> > tasks_queued; |
| 1527 { |
| 1528 base::AutoLock autolock(lock_); |
| 1529 keys_loaded_.insert(key); |
| 1530 std::map<std::string, std::deque<scoped_refptr<CookieMonsterTask> > > |
| 1531 ::iterator it = tasks_queued_.find(key); |
| 1532 if (it == tasks_queued_.end()) |
| 1533 return; |
| 1534 it->second.swap(tasks_queued); |
| 1535 tasks_queued_.erase(it); |
| 1536 } |
| 1537 |
| 1538 while (!tasks_queued.empty()) { |
| 1539 scoped_refptr<CookieMonsterTask> task = tasks_queued.front(); |
| 1540 task->Run(); |
| 1541 tasks_queued.pop_front(); |
| 1542 } |
| 1543 } |
| 1544 |
1473 void CookieMonster::StoreLoadedCookies( | 1545 void CookieMonster::StoreLoadedCookies( |
1474 const std::vector<CanonicalCookie*>& cookies) { | 1546 const std::vector<CanonicalCookie*>& cookies) { |
1475 // Initialize the store and sync in any saved persistent cookies. We don't | 1547 // Initialize the store and sync in any saved persistent cookies. We don't |
1476 // care if it's expired, insert it so it can be garbage collected, removed, | 1548 // care if it's expired, insert it so it can be garbage collected, removed, |
1477 // and sync'd. | 1549 // and sync'd. |
1478 base::AutoLock autolock(lock_); | 1550 base::AutoLock autolock(lock_); |
1479 | 1551 |
1480 // Avoid ever letting cookies with duplicate creation times into the store; | |
1481 // that way we don't have to worry about what sections of code are safe | |
1482 // to call while it's in that state. | |
1483 std::set<int64> creation_times; | |
1484 | |
1485 // Presumably later than any access time in the store. | |
1486 Time earliest_access_time; | |
1487 | |
1488 for (std::vector<CanonicalCookie*>::const_iterator it = cookies.begin(); | 1552 for (std::vector<CanonicalCookie*>::const_iterator it = cookies.begin(); |
1489 it != cookies.end(); ++it) { | 1553 it != cookies.end(); ++it) { |
1490 int64 cookie_creation_time = (*it)->CreationDate().ToInternalValue(); | 1554 int64 cookie_creation_time = (*it)->CreationDate().ToInternalValue(); |
1491 | 1555 |
1492 if (creation_times.insert(cookie_creation_time).second) { | 1556 if (creation_times_.insert(cookie_creation_time).second) { |
1493 InternalInsertCookie(GetKey((*it)->Domain()), *it, false); | 1557 InternalInsertCookie(GetKey((*it)->Domain()), *it, false); |
1494 const Time cookie_access_time((*it)->LastAccessDate()); | 1558 const Time cookie_access_time((*it)->LastAccessDate()); |
1495 if (earliest_access_time.is_null() || | 1559 if (earliest_access_time_.is_null() || |
1496 cookie_access_time < earliest_access_time) | 1560 cookie_access_time < earliest_access_time_) |
1497 earliest_access_time = cookie_access_time; | 1561 earliest_access_time_ = cookie_access_time; |
1498 } else { | 1562 } else { |
1499 LOG(ERROR) << base::StringPrintf("Found cookies with duplicate creation " | 1563 LOG(ERROR) << base::StringPrintf("Found cookies with duplicate creation " |
1500 "times in backing store: " | 1564 "times in backing store: " |
1501 "{name='%s', domain='%s', path='%s'}", | 1565 "{name='%s', domain='%s', path='%s'}", |
1502 (*it)->Name().c_str(), | 1566 (*it)->Name().c_str(), |
1503 (*it)->Domain().c_str(), | 1567 (*it)->Domain().c_str(), |
1504 (*it)->Path().c_str()); | 1568 (*it)->Path().c_str()); |
1505 // We've been given ownership of the cookie and are throwing it | 1569 // We've been given ownership of the cookie and are throwing it |
1506 // away; reclaim the space. | 1570 // away; reclaim the space. |
1507 delete (*it); | 1571 delete (*it); |
1508 } | 1572 } |
1509 } | 1573 } |
1510 earliest_access_time_= earliest_access_time; | |
1511 | 1574 |
1512 // After importing cookies from the PersistentCookieStore, verify that | 1575 // After importing cookies from the PersistentCookieStore, verify that |
1513 // none of our other constraints are violated. | 1576 // none of our other constraints are violated. |
1514 // | |
1515 // In particular, the backing store might have given us duplicate cookies. | 1577 // In particular, the backing store might have given us duplicate cookies. |
| 1578 |
| 1579 // This method could be called multiple times due to priority loading, thus |
| 1580 // cookies loaded in previous runs will be validated again, but this is OK |
| 1581 // since they are expected to be much fewer than total DB. |
1516 EnsureCookiesMapIsValid(); | 1582 EnsureCookiesMapIsValid(); |
1517 } | 1583 } |
1518 | 1584 |
1519 void CookieMonster::InvokeQueue() { | 1585 void CookieMonster::InvokeQueue() { |
1520 while (true) { | 1586 while (true) { |
1521 scoped_refptr<CookieMonsterTask> request_task; | 1587 scoped_refptr<CookieMonsterTask> request_task; |
1522 { | 1588 { |
1523 base::AutoLock autolock(lock_); | 1589 base::AutoLock autolock(lock_); |
1524 if (queue_.empty()) { | 1590 if (queue_.empty()) { |
1525 loaded_ = true; | 1591 loaded_ = true; |
| 1592 creation_times_.clear(); |
| 1593 keys_loaded_.clear(); |
1526 break; | 1594 break; |
1527 } | 1595 } |
1528 request_task = queue_.front(); | 1596 request_task = queue_.front(); |
1529 queue_.pop(); | 1597 queue_.pop(); |
1530 } | 1598 } |
1531 request_task->Run(); | 1599 request_task->Run(); |
1532 } | 1600 } |
1533 } | 1601 } |
1534 | 1602 |
1535 void CookieMonster::EnsureCookiesMapIsValid() { | 1603 void CookieMonster::EnsureCookiesMapIsValid() { |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2764 std::string CookieMonster::CanonicalCookie::DebugString() const { | 2832 std::string CookieMonster::CanonicalCookie::DebugString() const { |
2765 return base::StringPrintf( | 2833 return base::StringPrintf( |
2766 "name: %s value: %s domain: %s path: %s creation: %" | 2834 "name: %s value: %s domain: %s path: %s creation: %" |
2767 PRId64, | 2835 PRId64, |
2768 name_.c_str(), value_.c_str(), | 2836 name_.c_str(), value_.c_str(), |
2769 domain_.c_str(), path_.c_str(), | 2837 domain_.c_str(), path_.c_str(), |
2770 static_cast<int64>(creation_date_.ToTimeT())); | 2838 static_cast<int64>(creation_date_.ToTimeT())); |
2771 } | 2839 } |
2772 | 2840 |
2773 } // namespace | 2841 } // namespace |
OLD | NEW |