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

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

Issue 5430004: Refactored cookies persistent store clean-up on shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lock protected the clear on exit flag. Created 10 years 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/base/cookie_monster.h ('k') | net/base/cookie_monster_store_test.h » ('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) 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 static const char* kDefaultCookieableSchemes[] = { "http", "https", "file" }; 399 static const char* kDefaultCookieableSchemes[] = { "http", "https", "file" };
400 int num_schemes = enable_file_scheme_ ? 3 : 2; 400 int num_schemes = enable_file_scheme_ ? 3 : 2;
401 SetCookieableSchemes(kDefaultCookieableSchemes, num_schemes); 401 SetCookieableSchemes(kDefaultCookieableSchemes, num_schemes);
402 } 402 }
403 403
404 void CookieMonster::SetExpiryAndKeyScheme(ExpiryAndKeyScheme key_scheme) { 404 void CookieMonster::SetExpiryAndKeyScheme(ExpiryAndKeyScheme key_scheme) {
405 DCHECK(!initialized_); 405 DCHECK(!initialized_);
406 expiry_and_key_scheme_ = key_scheme; 406 expiry_and_key_scheme_ = key_scheme;
407 } 407 }
408 408
409 void CookieMonster::SetClearPersistentStoreOnExit(bool clear_local_store) {
410 if(store_)
411 store_->SetClearLocalStateOnExit(clear_local_store);
412 }
413
409 // The system resolution is not high enough, so we can have multiple 414 // The system resolution is not high enough, so we can have multiple
410 // set cookies that result in the same system time. When this happens, we 415 // set cookies that result in the same system time. When this happens, we
411 // increment by one Time unit. Let's hope computers don't get too fast. 416 // increment by one Time unit. Let's hope computers don't get too fast.
412 Time CookieMonster::CurrentTime() { 417 Time CookieMonster::CurrentTime() {
413 return std::max(Time::Now(), 418 return std::max(Time::Now(),
414 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1)); 419 Time::FromInternalValue(last_time_seen_.ToInternalValue() + 1));
415 } 420 }
416 421
417 // Parse a cookie expiration time. We try to be lenient, but we need to 422 // Parse a cookie expiration time. We try to be lenient, but we need to
418 // assume some order to distinguish the fields. The basic rules: 423 // assume some order to distinguish the fields. The basic rules:
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 return base::StringPrintf( 1996 return base::StringPrintf(
1992 "name: %s value: %s domain: %s path: %s creation: %" 1997 "name: %s value: %s domain: %s path: %s creation: %"
1993 PRId64, 1998 PRId64,
1994 name_.c_str(), value_.c_str(), 1999 name_.c_str(), value_.c_str(),
1995 domain_.c_str(), path_.c_str(), 2000 domain_.c_str(), path_.c_str(),
1996 static_cast<int64>(creation_date_.ToTimeT())); 2001 static_cast<int64>(creation_date_.ToTimeT()));
1997 } 2002 }
1998 2003
1999 } // namespace 2004 } // namespace
2000 2005
OLDNEW
« no previous file with comments | « net/base/cookie_monster.h ('k') | net/base/cookie_monster_store_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698