OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 if (creation_times.insert(cookie_creation_time).second) { | 197 if (creation_times.insert(cookie_creation_time).second) { |
198 InternalInsertCookie(it->first, it->second, false); | 198 InternalInsertCookie(it->first, it->second, false); |
199 } else { | 199 } else { |
200 LOG(ERROR) << StringPrintf("Found cookies with duplicate creation " | 200 LOG(ERROR) << StringPrintf("Found cookies with duplicate creation " |
201 "times in backing store: " | 201 "times in backing store: " |
202 "{name='%s', domain='%s', path='%s'}", | 202 "{name='%s', domain='%s', path='%s'}", |
203 it->second->Name().c_str(), | 203 it->second->Name().c_str(), |
204 it->first.c_str(), | 204 it->first.c_str(), |
205 it->second->Path().c_str()); | 205 it->second->Path().c_str()); |
| 206 // We've been given ownership of the cookie and are throwing it |
| 207 // away; reclaim the space. |
| 208 delete it->second; |
206 } | 209 } |
207 } | 210 } |
208 | 211 |
209 // After importing cookies from the PersistentCookieStore, verify that | 212 // After importing cookies from the PersistentCookieStore, verify that |
210 // none of our other constraints are violated. | 213 // none of our other constraints are violated. |
211 // | 214 // |
212 // In particular, the backing store might have given us duplicate cookies. | 215 // In particular, the backing store might have given us duplicate cookies. |
213 EnsureCookiesMapIsValid(); | 216 EnsureCookiesMapIsValid(); |
214 } | 217 } |
215 | 218 |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 std::string CookieMonster::CanonicalCookie::DebugString() const { | 1678 std::string CookieMonster::CanonicalCookie::DebugString() const { |
1676 return StringPrintf("name: %s value: %s domain: %s path: %s creation: %" | 1679 return StringPrintf("name: %s value: %s domain: %s path: %s creation: %" |
1677 PRId64, | 1680 PRId64, |
1678 name_.c_str(), value_.c_str(), | 1681 name_.c_str(), value_.c_str(), |
1679 domain_.c_str(), path_.c_str(), | 1682 domain_.c_str(), path_.c_str(), |
1680 static_cast<int64>(creation_date_.ToTimeT())); | 1683 static_cast<int64>(creation_date_.ToTimeT())); |
1681 } | 1684 } |
1682 | 1685 |
1683 } // namespace | 1686 } // namespace |
1684 | 1687 |
OLD | NEW |