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

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

Issue 63153003: mac: Prepare for -Wunused-functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return diff < 0; 194 return diff < 0;
195 195
196 return path.compare(cs.path) < 0; 196 return path.compare(cs.path) < 0;
197 } 197 }
198 198
199 std::string name; 199 std::string name;
200 std::string domain; 200 std::string domain;
201 std::string path; 201 std::string path;
202 }; 202 };
203 203
204 // Determine the cookie domain to use for setting the specified cookie.
205 bool GetCookieDomain(const GURL& url,
206 const ParsedCookie& pc,
207 std::string* result) {
208 std::string domain_string;
209 if (pc.HasDomain())
210 domain_string = pc.Domain();
211 return cookie_util::GetCookieDomainWithString(url, domain_string, result);
212 }
213
214 // For a CookieItVector iterator range [|it_begin|, |it_end|), 204 // For a CookieItVector iterator range [|it_begin|, |it_end|),
215 // sorts the first |num_sort| + 1 elements by LastAccessDate(). 205 // sorts the first |num_sort| + 1 elements by LastAccessDate().
216 // The + 1 element exists so for any interval of length <= |num_sort| starting 206 // The + 1 element exists so for any interval of length <= |num_sort| starting
217 // from |cookies_its_begin|, a LastAccessDate() bound can be found. 207 // from |cookies_its_begin|, a LastAccessDate() bound can be found.
218 void SortLeastRecentlyAccessed( 208 void SortLeastRecentlyAccessed(
219 CookieMonster::CookieItVector::iterator it_begin, 209 CookieMonster::CookieItVector::iterator it_begin,
220 CookieMonster::CookieItVector::iterator it_end, 210 CookieMonster::CookieItVector::iterator it_end,
221 size_t num_sort) { 211 size_t num_sort) {
222 DCHECK_LT(static_cast<int>(num_sort), it_end - it_begin); 212 DCHECK_LT(static_cast<int>(num_sort), it_end - it_begin);
223 std::partial_sort(it_begin, it_begin + num_sort + 1, it_end, LRACookieSorter); 213 std::partial_sort(it_begin, it_begin + num_sort + 1, it_end, LRACookieSorter);
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 2246
2257 // The system resolution is not high enough, so we can have multiple 2247 // The system resolution is not high enough, so we can have multiple
2258 // set cookies that result in the same system time. When this happens, we 2248 // set cookies that result in the same system time. When this happens, we
2259 // increment by one Time unit. Let's hope computers don't get too fast. 2249 // increment by one Time unit. Let's hope computers don't get too fast.
2260 Time CookieMonster::CurrentTime() { 2250 Time CookieMonster::CurrentTime() {
2261 return std::max(Time::Now(), 2251 return std::max(Time::Now(),
2262 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); 2252 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1));
2263 } 2253 }
2264 2254
2265 } // namespace net 2255 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698