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

Side by Side Diff: content/browser/net/sqlite_persistent_cookie_store.cc

Issue 1077963006: Revert of Delete session cookies immediately after loading the cookie DB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_to_v9
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « no previous file | content/browser/net/sqlite_persistent_cookie_store_unittest.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 #include "content/browser/net/sqlite_persistent_cookie_store.h" 5 #include "content/browser/net/sqlite_persistent_cookie_store.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), 688 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1),
689 50); 689 50);
690 690
691 UMA_HISTOGRAM_CUSTOM_TIMES( 691 UMA_HISTOGRAM_CUSTOM_TIMES(
692 "Cookie.TimeInitializeDomainMap", 692 "Cookie.TimeInitializeDomainMap",
693 base::Time::Now() - start, 693 base::Time::Now() - start,
694 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), 694 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1),
695 50); 695 50);
696 696
697 initialized_ = true; 697 initialized_ = true;
698
699 if (!restore_old_session_cookies_)
700 DeleteSessionCookiesOnStartup();
701 return true; 698 return true;
702 } 699 }
703 700
704 void SQLitePersistentCookieStore::Backend::ChainLoadCookies( 701 void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
705 const LoadedCallback& loaded_callback) { 702 const LoadedCallback& loaded_callback) {
706 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 703 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
707 IncrementTimeDelta increment(&cookie_load_duration_); 704 IncrementTimeDelta increment(&cookie_load_duration_);
708 705
709 bool load_success = true; 706 bool load_success = true;
710 707
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 } 1283 }
1287 } 1284 }
1288 1285
1289 void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() { 1286 void SQLitePersistentCookieStore::Backend::SetForceKeepSessionState() {
1290 base::AutoLock locked(lock_); 1287 base::AutoLock locked(lock_);
1291 force_keep_session_state_ = true; 1288 force_keep_session_state_ = true;
1292 } 1289 }
1293 1290
1294 void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnStartup() { 1291 void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnStartup() {
1295 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1292 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
1296 if (!db_->Execute("DELETE FROM cookies WHERE persistent != 1")) 1293 if (!db_->Execute("DELETE FROM cookies WHERE persistent == 0"))
1297 LOG(WARNING) << "Unable to delete session cookies."; 1294 LOG(WARNING) << "Unable to delete session cookies.";
1298 } 1295 }
1299 1296
1300 void SQLitePersistentCookieStore::Backend::PostBackgroundTask( 1297 void SQLitePersistentCookieStore::Backend::PostBackgroundTask(
1301 const tracked_objects::Location& origin, const base::Closure& task) { 1298 const tracked_objects::Location& origin, const base::Closure& task) {
1302 if (!background_task_runner_->PostTask(origin, task)) { 1299 if (!background_task_runner_->PostTask(origin, task)) {
1303 LOG(WARNING) << "Failed to post task from " << origin.ToString() 1300 LOG(WARNING) << "Failed to post task from " << origin.ToString()
1304 << " to background_task_runner_."; 1301 << " to background_task_runner_.";
1305 } 1302 }
1306 } 1303 }
1307 1304
1308 void SQLitePersistentCookieStore::Backend::PostClientTask( 1305 void SQLitePersistentCookieStore::Backend::PostClientTask(
1309 const tracked_objects::Location& origin, const base::Closure& task) { 1306 const tracked_objects::Location& origin, const base::Closure& task) {
1310 if (!client_task_runner_->PostTask(origin, task)) { 1307 if (!client_task_runner_->PostTask(origin, task)) {
1311 LOG(WARNING) << "Failed to post task from " << origin.ToString() 1308 LOG(WARNING) << "Failed to post task from " << origin.ToString()
1312 << " to client_task_runner_."; 1309 << " to client_task_runner_.";
1313 } 1310 }
1314 } 1311 }
1315 1312
1316 void SQLitePersistentCookieStore::Backend::FinishedLoadingCookies( 1313 void SQLitePersistentCookieStore::Backend::FinishedLoadingCookies(
1317 const LoadedCallback& loaded_callback, 1314 const LoadedCallback& loaded_callback,
1318 bool success) { 1315 bool success) {
1319 PostClientTask(FROM_HERE, base::Bind(&Backend::CompleteLoadInForeground, this, 1316 PostClientTask(FROM_HERE, base::Bind(&Backend::CompleteLoadInForeground, this,
1320 loaded_callback, success)); 1317 loaded_callback, success));
1318 if (success && !restore_old_session_cookies_)
1319 DeleteSessionCookiesOnStartup();
1321 } 1320 }
1322 1321
1323 SQLitePersistentCookieStore::SQLitePersistentCookieStore( 1322 SQLitePersistentCookieStore::SQLitePersistentCookieStore(
1324 const base::FilePath& path, 1323 const base::FilePath& path,
1325 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner, 1324 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner,
1326 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 1325 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
1327 bool restore_old_session_cookies, 1326 bool restore_old_session_cookies,
1328 storage::SpecialStoragePolicy* special_storage_policy, 1327 storage::SpecialStoragePolicy* special_storage_policy,
1329 net::CookieCryptoDelegate* crypto_delegate) 1328 net::CookieCryptoDelegate* crypto_delegate)
1330 : backend_(new Backend(path, 1329 : backend_(new Backend(path,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 (config.session_cookie_mode == 1433 (config.session_cookie_mode ==
1435 CookieStoreConfig::RESTORED_SESSION_COOKIES)) { 1434 CookieStoreConfig::RESTORED_SESSION_COOKIES)) {
1436 cookie_monster->SetPersistSessionCookies(true); 1435 cookie_monster->SetPersistSessionCookies(true);
1437 } 1436 }
1438 } 1437 }
1439 1438
1440 return cookie_monster; 1439 return cookie_monster;
1441 } 1440 }
1442 1441
1443 } // namespace content 1442 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/net/sqlite_persistent_cookie_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698