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

Side by Side Diff: net/extras/sqlite/sqlite_persistent_cookie_store.cc

Issue 2894863002: Rename TaskRunner::RunsTasksOnCurrentThread() in //net (Closed)
Patch Set: fixed build error Created 3 years, 7 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 | « net/extras/sqlite/sqlite_channel_id_store.cc ('k') | net/http/http_server_properties_manager.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) 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 "net/extras/sqlite/sqlite_persistent_cookie_store.h" 5 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 PostBackgroundTask( 493 PostBackgroundTask(
494 FROM_HERE, base::Bind(&Backend::LoadKeyAndNotifyInBackground, this, key, 494 FROM_HERE, base::Bind(&Backend::LoadKeyAndNotifyInBackground, this, key,
495 loaded_callback, base::Time::Now())); 495 loaded_callback, base::Time::Now()));
496 } 496 }
497 497
498 void SQLitePersistentCookieStore::Backend::LoadAndNotifyInBackground( 498 void SQLitePersistentCookieStore::Backend::LoadAndNotifyInBackground(
499 const LoadedCallback& loaded_callback, 499 const LoadedCallback& loaded_callback,
500 const base::Time& posted_at) { 500 const base::Time& posted_at) {
501 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 501 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
502 IncrementTimeDelta increment(&cookie_load_duration_); 502 IncrementTimeDelta increment(&cookie_load_duration_);
503 503
504 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.TimeLoadDBQueueWait", 504 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.TimeLoadDBQueueWait",
505 base::Time::Now() - posted_at, 505 base::Time::Now() - posted_at,
506 base::TimeDelta::FromMilliseconds(1), 506 base::TimeDelta::FromMilliseconds(1),
507 base::TimeDelta::FromMinutes(1), 50); 507 base::TimeDelta::FromMinutes(1), 50);
508 508
509 if (!InitializeDatabase()) { 509 if (!InitializeDatabase()) {
510 PostClientTask(FROM_HERE, base::Bind(&Backend::CompleteLoadInForeground, 510 PostClientTask(FROM_HERE, base::Bind(&Backend::CompleteLoadInForeground,
511 this, loaded_callback, false)); 511 this, loaded_callback, false));
512 } else { 512 } else {
513 ChainLoadCookies(loaded_callback); 513 ChainLoadCookies(loaded_callback);
514 } 514 }
515 } 515 }
516 516
517 void SQLitePersistentCookieStore::Backend::LoadKeyAndNotifyInBackground( 517 void SQLitePersistentCookieStore::Backend::LoadKeyAndNotifyInBackground(
518 const std::string& key, 518 const std::string& key,
519 const LoadedCallback& loaded_callback, 519 const LoadedCallback& loaded_callback,
520 const base::Time& posted_at) { 520 const base::Time& posted_at) {
521 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 521 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
522 IncrementTimeDelta increment(&cookie_load_duration_); 522 IncrementTimeDelta increment(&cookie_load_duration_);
523 523
524 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.TimeKeyLoadDBQueueWait", 524 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.TimeKeyLoadDBQueueWait",
525 base::Time::Now() - posted_at, 525 base::Time::Now() - posted_at,
526 base::TimeDelta::FromMilliseconds(1), 526 base::TimeDelta::FromMilliseconds(1),
527 base::TimeDelta::FromMinutes(1), 50); 527 base::TimeDelta::FromMinutes(1), 50);
528 528
529 bool success = false; 529 bool success = false;
530 if (InitializeDatabase()) { 530 if (InitializeDatabase()) {
531 std::map<std::string, std::set<std::string>>::iterator it = 531 std::map<std::string, std::set<std::string>>::iterator it =
(...skipping 17 matching lines...) Expand all
549 const base::Closure& callback) { 549 const base::Closure& callback) {
550 Commit(); 550 Commit();
551 if (!callback.is_null()) 551 if (!callback.is_null())
552 PostClientTask(FROM_HERE, callback); 552 PostClientTask(FROM_HERE, callback);
553 } 553 }
554 554
555 void SQLitePersistentCookieStore::Backend::CompleteLoadForKeyInForeground( 555 void SQLitePersistentCookieStore::Backend::CompleteLoadForKeyInForeground(
556 const LoadedCallback& loaded_callback, 556 const LoadedCallback& loaded_callback,
557 bool load_success, 557 bool load_success,
558 const ::Time& requested_at) { 558 const ::Time& requested_at) {
559 DCHECK(client_task_runner_->RunsTasksOnCurrentThread()); 559 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
560 560
561 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.TimeKeyLoadTotalWait", 561 UMA_HISTOGRAM_CUSTOM_TIMES("Cookie.TimeKeyLoadTotalWait",
562 base::Time::Now() - requested_at, 562 base::Time::Now() - requested_at,
563 base::TimeDelta::FromMilliseconds(1), 563 base::TimeDelta::FromMilliseconds(1),
564 base::TimeDelta::FromMinutes(1), 50); 564 base::TimeDelta::FromMinutes(1), 50);
565 565
566 Notify(loaded_callback, load_success); 566 Notify(loaded_callback, load_success);
567 567
568 { 568 {
569 base::AutoLock locked(metrics_lock_); 569 base::AutoLock locked(metrics_lock_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 bool load_success) { 608 bool load_success) {
609 Notify(loaded_callback, load_success); 609 Notify(loaded_callback, load_success);
610 610
611 if (load_success) 611 if (load_success)
612 ReportMetrics(); 612 ReportMetrics();
613 } 613 }
614 614
615 void SQLitePersistentCookieStore::Backend::Notify( 615 void SQLitePersistentCookieStore::Backend::Notify(
616 const LoadedCallback& loaded_callback, 616 const LoadedCallback& loaded_callback,
617 bool load_success) { 617 bool load_success) {
618 DCHECK(client_task_runner_->RunsTasksOnCurrentThread()); 618 DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
619 619
620 std::vector<std::unique_ptr<CanonicalCookie>> cookies; 620 std::vector<std::unique_ptr<CanonicalCookie>> cookies;
621 { 621 {
622 base::AutoLock locked(lock_); 622 base::AutoLock locked(lock_);
623 cookies.swap(cookies_); 623 cookies.swap(cookies_);
624 } 624 }
625 625
626 loaded_callback.Run(std::move(cookies)); 626 loaded_callback.Run(std::move(cookies));
627 } 627 }
628 628
629 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { 629 bool SQLitePersistentCookieStore::Backend::InitializeDatabase() {
630 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 630 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
631 631
632 if (initialized_ || corruption_detected_) { 632 if (initialized_ || corruption_detected_) {
633 // Return false if we were previously initialized but the DB has since been 633 // Return false if we were previously initialized but the DB has since been
634 // closed, or if corruption caused a database reset during initialization. 634 // closed, or if corruption caused a database reset during initialization.
635 return db_ != NULL; 635 return db_ != NULL;
636 } 636 }
637 637
638 base::Time start = base::Time::Now(); 638 base::Time start = base::Time::Now();
639 639
640 const base::FilePath dir = path_.DirName(); 640 const base::FilePath dir = path_.DirName();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 723
724 initialized_ = true; 724 initialized_ = true;
725 725
726 if (!restore_old_session_cookies_) 726 if (!restore_old_session_cookies_)
727 DeleteSessionCookiesOnStartup(); 727 DeleteSessionCookiesOnStartup();
728 return true; 728 return true;
729 } 729 }
730 730
731 void SQLitePersistentCookieStore::Backend::ChainLoadCookies( 731 void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
732 const LoadedCallback& loaded_callback) { 732 const LoadedCallback& loaded_callback) {
733 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 733 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
734 IncrementTimeDelta increment(&cookie_load_duration_); 734 IncrementTimeDelta increment(&cookie_load_duration_);
735 735
736 bool load_success = true; 736 bool load_success = true;
737 737
738 if (!db_) { 738 if (!db_) {
739 // Close() has been called on this store. 739 // Close() has been called on this store.
740 load_success = false; 740 load_success = false;
741 } else if (keys_to_load_.size() > 0) { 741 } else if (keys_to_load_.size() > 0) {
742 // Load cookies for the first domain key. 742 // Load cookies for the first domain key.
743 std::map<std::string, std::set<std::string>>::iterator it = 743 std::map<std::string, std::set<std::string>>::iterator it =
(...skipping 14 matching lines...) Expand all
758 LOG(WARNING) << "Failed to post task from " << FROM_HERE.ToString() 758 LOG(WARNING) << "Failed to post task from " << FROM_HERE.ToString()
759 << " to background_task_runner_."; 759 << " to background_task_runner_.";
760 } 760 }
761 } else { 761 } else {
762 FinishedLoadingCookies(loaded_callback, load_success); 762 FinishedLoadingCookies(loaded_callback, load_success);
763 } 763 }
764 } 764 }
765 765
766 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains( 766 bool SQLitePersistentCookieStore::Backend::LoadCookiesForDomains(
767 const std::set<std::string>& domains) { 767 const std::set<std::string>& domains) {
768 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 768 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
769 769
770 sql::Statement smt; 770 sql::Statement smt;
771 if (restore_old_session_cookies_) { 771 if (restore_old_session_cookies_) {
772 smt.Assign(db_->GetCachedStatement( 772 smt.Assign(db_->GetCachedStatement(
773 SQL_FROM_HERE, 773 SQL_FROM_HERE,
774 "SELECT creation_utc, host_key, name, value, encrypted_value, path, " 774 "SELECT creation_utc, host_key, name, value, encrypted_value, path, "
775 "expires_utc, secure, httponly, firstpartyonly, last_access_utc, " 775 "expires_utc, secure, httponly, firstpartyonly, last_access_utc, "
776 "has_expires, persistent, priority FROM cookies WHERE host_key = ?")); 776 "has_expires, persistent, priority FROM cookies WHERE host_key = ?"));
777 } else { 777 } else {
778 smt.Assign(db_->GetCachedStatement( 778 smt.Assign(db_->GetCachedStatement(
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 BatchOperation(PendingOperation::COOKIE_DELETE, cc); 1066 BatchOperation(PendingOperation::COOKIE_DELETE, cc);
1067 } 1067 }
1068 1068
1069 void SQLitePersistentCookieStore::Backend::BatchOperation( 1069 void SQLitePersistentCookieStore::Backend::BatchOperation(
1070 PendingOperation::OperationType op, 1070 PendingOperation::OperationType op,
1071 const CanonicalCookie& cc) { 1071 const CanonicalCookie& cc) {
1072 // Commit every 30 seconds. 1072 // Commit every 30 seconds.
1073 static const int kCommitIntervalMs = 30 * 1000; 1073 static const int kCommitIntervalMs = 30 * 1000;
1074 // Commit right away if we have more than 512 outstanding operations. 1074 // Commit right away if we have more than 512 outstanding operations.
1075 static const size_t kCommitAfterBatchSize = 512; 1075 static const size_t kCommitAfterBatchSize = 512;
1076 DCHECK(!background_task_runner_->RunsTasksOnCurrentThread()); 1076 DCHECK(!background_task_runner_->RunsTasksInCurrentSequence());
1077 1077
1078 // We do a full copy of the cookie here, and hopefully just here. 1078 // We do a full copy of the cookie here, and hopefully just here.
1079 std::unique_ptr<PendingOperation> po(new PendingOperation(op, cc)); 1079 std::unique_ptr<PendingOperation> po(new PendingOperation(op, cc));
1080 1080
1081 PendingOperationsList::size_type num_pending; 1081 PendingOperationsList::size_type num_pending;
1082 { 1082 {
1083 base::AutoLock locked(lock_); 1083 base::AutoLock locked(lock_);
1084 pending_.push_back(po.release()); 1084 pending_.push_back(po.release());
1085 num_pending = ++num_pending_; 1085 num_pending = ++num_pending_;
1086 } 1086 }
1087 1087
1088 if (num_pending == 1) { 1088 if (num_pending == 1) {
1089 // We've gotten our first entry for this batch, fire off the timer. 1089 // We've gotten our first entry for this batch, fire off the timer.
1090 if (!background_task_runner_->PostDelayedTask( 1090 if (!background_task_runner_->PostDelayedTask(
1091 FROM_HERE, base::Bind(&Backend::Commit, this), 1091 FROM_HERE, base::Bind(&Backend::Commit, this),
1092 base::TimeDelta::FromMilliseconds(kCommitIntervalMs))) { 1092 base::TimeDelta::FromMilliseconds(kCommitIntervalMs))) {
1093 NOTREACHED() << "background_task_runner_ is not running."; 1093 NOTREACHED() << "background_task_runner_ is not running.";
1094 } 1094 }
1095 } else if (num_pending == kCommitAfterBatchSize) { 1095 } else if (num_pending == kCommitAfterBatchSize) {
1096 // We've reached a big enough batch, fire off a commit now. 1096 // We've reached a big enough batch, fire off a commit now.
1097 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::Commit, this)); 1097 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::Commit, this));
1098 } 1098 }
1099 } 1099 }
1100 1100
1101 void SQLitePersistentCookieStore::Backend::Commit() { 1101 void SQLitePersistentCookieStore::Backend::Commit() {
1102 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1102 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
1103 1103
1104 PendingOperationsList ops; 1104 PendingOperationsList ops;
1105 { 1105 {
1106 base::AutoLock locked(lock_); 1106 base::AutoLock locked(lock_);
1107 pending_.swap(ops); 1107 pending_.swap(ops);
1108 num_pending_ = 0; 1108 num_pending_ = 0;
1109 } 1109 }
1110 1110
1111 // Maybe an old timer fired or we are already Close()'ed. 1111 // Maybe an old timer fired or we are already Close()'ed.
1112 if (!db_.get() || ops.empty()) 1112 if (!db_.get() || ops.empty())
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 break; 1195 break;
1196 } 1196 }
1197 } 1197 }
1198 bool succeeded = transaction.Commit(); 1198 bool succeeded = transaction.Commit();
1199 UMA_HISTOGRAM_ENUMERATION("Cookie.BackingStoreUpdateResults", 1199 UMA_HISTOGRAM_ENUMERATION("Cookie.BackingStoreUpdateResults",
1200 succeeded ? 0 : 1, 2); 1200 succeeded ? 0 : 1, 2);
1201 } 1201 }
1202 1202
1203 void SQLitePersistentCookieStore::Backend::Flush( 1203 void SQLitePersistentCookieStore::Backend::Flush(
1204 const base::Closure& callback) { 1204 const base::Closure& callback) {
1205 DCHECK(!background_task_runner_->RunsTasksOnCurrentThread()); 1205 DCHECK(!background_task_runner_->RunsTasksInCurrentSequence());
1206 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::FlushAndNotifyInBackground, 1206 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::FlushAndNotifyInBackground,
1207 this, callback)); 1207 this, callback));
1208 } 1208 }
1209 1209
1210 // Fire off a close message to the background runner. We could still have a 1210 // Fire off a close message to the background runner. We could still have a
1211 // pending commit timer or Load operations holding references on us, but if/when 1211 // pending commit timer or Load operations holding references on us, but if/when
1212 // this fires we will already have been cleaned up and it will be ignored. 1212 // this fires we will already have been cleaned up and it will be ignored.
1213 void SQLitePersistentCookieStore::Backend::Close( 1213 void SQLitePersistentCookieStore::Backend::Close(
1214 const base::Closure& callback) { 1214 const base::Closure& callback) {
1215 if (background_task_runner_->RunsTasksOnCurrentThread()) { 1215 if (background_task_runner_->RunsTasksInCurrentSequence()) {
1216 InternalBackgroundClose(callback); 1216 InternalBackgroundClose(callback);
1217 } else { 1217 } else {
1218 // Must close the backend on the background runner. 1218 // Must close the backend on the background runner.
1219 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::InternalBackgroundClose, 1219 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::InternalBackgroundClose,
1220 this, callback)); 1220 this, callback));
1221 } 1221 }
1222 } 1222 }
1223 1223
1224 void SQLitePersistentCookieStore::Backend::InternalBackgroundClose( 1224 void SQLitePersistentCookieStore::Backend::InternalBackgroundClose(
1225 const base::Closure& callback) { 1225 const base::Closure& callback) {
1226 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1226 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
1227 // Commit any pending operations 1227 // Commit any pending operations
1228 Commit(); 1228 Commit();
1229 1229
1230 meta_table_.Reset(); 1230 meta_table_.Reset();
1231 db_.reset(); 1231 db_.reset();
1232 1232
1233 // We're clean now. 1233 // We're clean now.
1234 if (!callback.is_null()) 1234 if (!callback.is_null())
1235 callback.Run(); 1235 callback.Run();
1236 } 1236 }
1237 1237
1238 void SQLitePersistentCookieStore::Backend::DatabaseErrorCallback( 1238 void SQLitePersistentCookieStore::Backend::DatabaseErrorCallback(
1239 int error, 1239 int error,
1240 sql::Statement* stmt) { 1240 sql::Statement* stmt) {
1241 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1241 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
1242 1242
1243 if (!sql::IsErrorCatastrophic(error)) 1243 if (!sql::IsErrorCatastrophic(error))
1244 return; 1244 return;
1245 1245
1246 // TODO(shess): Running KillDatabase() multiple times should be 1246 // TODO(shess): Running KillDatabase() multiple times should be
1247 // safe. 1247 // safe.
1248 if (corruption_detected_) 1248 if (corruption_detected_)
1249 return; 1249 return;
1250 1250
1251 corruption_detected_ = true; 1251 corruption_detected_ = true;
1252 1252
1253 // Don't just do the close/delete here, as we are being called by |db| and 1253 // Don't just do the close/delete here, as we are being called by |db| and
1254 // that seems dangerous. 1254 // that seems dangerous.
1255 // TODO(shess): Consider just calling RazeAndClose() immediately. 1255 // TODO(shess): Consider just calling RazeAndClose() immediately.
1256 // db_ may not be safe to reset at this point, but RazeAndClose() 1256 // db_ may not be safe to reset at this point, but RazeAndClose()
1257 // would cause the stack to unwind safely with errors. 1257 // would cause the stack to unwind safely with errors.
1258 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::KillDatabase, this)); 1258 PostBackgroundTask(FROM_HERE, base::Bind(&Backend::KillDatabase, this));
1259 } 1259 }
1260 1260
1261 void SQLitePersistentCookieStore::Backend::KillDatabase() { 1261 void SQLitePersistentCookieStore::Backend::KillDatabase() {
1262 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1262 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
1263 1263
1264 if (db_) { 1264 if (db_) {
1265 // This Backend will now be in-memory only. In a future run we will recreate 1265 // This Backend will now be in-memory only. In a future run we will recreate
1266 // the database. Hopefully things go better then! 1266 // the database. Hopefully things go better then!
1267 bool success = db_->RazeAndClose(); 1267 bool success = db_->RazeAndClose();
1268 UMA_HISTOGRAM_BOOLEAN("Cookie.KillDatabaseResult", success); 1268 UMA_HISTOGRAM_BOOLEAN("Cookie.KillDatabaseResult", success);
1269 meta_table_.Reset(); 1269 meta_table_.Reset();
1270 db_.reset(); 1270 db_.reset();
1271 } 1271 }
1272 } 1272 }
1273 1273
1274 void SQLitePersistentCookieStore::Backend::DeleteAllInList( 1274 void SQLitePersistentCookieStore::Backend::DeleteAllInList(
1275 const std::list<CookieOrigin>& cookies) { 1275 const std::list<CookieOrigin>& cookies) {
1276 if (cookies.empty()) 1276 if (cookies.empty())
1277 return; 1277 return;
1278 1278
1279 if (background_task_runner_->RunsTasksOnCurrentThread()) { 1279 if (background_task_runner_->RunsTasksInCurrentSequence()) {
1280 BackgroundDeleteAllInList(cookies); 1280 BackgroundDeleteAllInList(cookies);
1281 } else { 1281 } else {
1282 // Perform deletion on background task runner. 1282 // Perform deletion on background task runner.
1283 PostBackgroundTask( 1283 PostBackgroundTask(
1284 FROM_HERE, 1284 FROM_HERE,
1285 base::Bind(&Backend::BackgroundDeleteAllInList, this, cookies)); 1285 base::Bind(&Backend::BackgroundDeleteAllInList, this, cookies));
1286 } 1286 }
1287 } 1287 }
1288 1288
1289 void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnStartup() { 1289 void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnStartup() {
1290 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1290 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
1291 base::Time start_time = base::Time::Now(); 1291 base::Time start_time = base::Time::Now();
1292 if (!db_->Execute("DELETE FROM cookies WHERE persistent != 1")) 1292 if (!db_->Execute("DELETE FROM cookies WHERE persistent != 1"))
1293 LOG(WARNING) << "Unable to delete session cookies."; 1293 LOG(WARNING) << "Unable to delete session cookies.";
1294 1294
1295 UMA_HISTOGRAM_TIMES("Cookie.Startup.TimeSpentDeletingCookies", 1295 UMA_HISTOGRAM_TIMES("Cookie.Startup.TimeSpentDeletingCookies",
1296 base::Time::Now() - start_time); 1296 base::Time::Now() - start_time);
1297 UMA_HISTOGRAM_COUNTS("Cookie.Startup.NumberOfCookiesDeleted", 1297 UMA_HISTOGRAM_COUNTS("Cookie.Startup.NumberOfCookiesDeleted",
1298 db_->GetLastChangeCount()); 1298 db_->GetLastChangeCount());
1299 } 1299 }
1300 1300
1301 void SQLitePersistentCookieStore::Backend::BackgroundDeleteAllInList( 1301 void SQLitePersistentCookieStore::Backend::BackgroundDeleteAllInList(
1302 const std::list<CookieOrigin>& cookies) { 1302 const std::list<CookieOrigin>& cookies) {
1303 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 1303 DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
1304 1304
1305 if (!db_) 1305 if (!db_)
1306 return; 1306 return;
1307 1307
1308 // Force a commit of any pending writes before issuing deletes. 1308 // Force a commit of any pending writes before issuing deletes.
1309 // TODO(rohitrao): Remove the need for this Commit() by instead pruning the 1309 // TODO(rohitrao): Remove the need for this Commit() by instead pruning the
1310 // list of pending operations. https://crbug.com/486742. 1310 // list of pending operations. https://crbug.com/486742.
1311 Commit(); 1311 Commit();
1312 1312
1313 sql::Statement del_smt(db_->GetCachedStatement( 1313 sql::Statement del_smt(db_->GetCachedStatement(
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { 1435 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) {
1436 if (backend_) 1436 if (backend_)
1437 backend_->Flush(callback); 1437 backend_->Flush(callback);
1438 } 1438 }
1439 1439
1440 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { 1440 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
1441 Close(base::Closure()); 1441 Close(base::Closure());
1442 } 1442 }
1443 1443
1444 } // namespace net 1444 } // namespace net
OLDNEW
« no previous file with comments | « net/extras/sqlite/sqlite_channel_id_store.cc ('k') | net/http/http_server_properties_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698