OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_channel_id_store.h" | 5 #include "net/extras/sqlite/sqlite_channel_id_store.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 db_.reset(); | 560 db_.reset(); |
561 } | 561 } |
562 | 562 |
563 void SQLiteChannelIDStore::Backend::BackgroundDeleteAllInList( | 563 void SQLiteChannelIDStore::Backend::BackgroundDeleteAllInList( |
564 const std::list<std::string>& server_identifiers) { | 564 const std::list<std::string>& server_identifiers) { |
565 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); | 565 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); |
566 | 566 |
567 if (!db_.get()) | 567 if (!db_.get()) |
568 return; | 568 return; |
569 | 569 |
570 // Force a commit of any pending writes before issuing deletes. | |
571 Commit(); | |
Ryan Sleevi
2015/03/19 02:45:56
It seems wasteful to Commit-and-Delete.
Would you
| |
572 | |
570 sql::Statement del_smt(db_->GetCachedStatement( | 573 sql::Statement del_smt(db_->GetCachedStatement( |
571 SQL_FROM_HERE, "DELETE FROM origin_bound_certs WHERE origin=?")); | 574 SQL_FROM_HERE, "DELETE FROM origin_bound_certs WHERE origin=?")); |
572 if (!del_smt.is_valid()) { | 575 if (!del_smt.is_valid()) { |
573 LOG(WARNING) << "Unable to delete channel ids."; | 576 LOG(WARNING) << "Unable to delete channel ids."; |
574 return; | 577 return; |
575 } | 578 } |
576 | 579 |
577 sql::Transaction transaction(db_.get()); | 580 sql::Transaction transaction(db_.get()); |
578 if (!transaction.Begin()) { | 581 if (!transaction.Begin()) { |
579 LOG(WARNING) << "Unable to delete channel ids."; | 582 LOG(WARNING) << "Unable to delete channel ids."; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 backend_->SetForceKeepSessionState(); | 630 backend_->SetForceKeepSessionState(); |
628 } | 631 } |
629 | 632 |
630 SQLiteChannelIDStore::~SQLiteChannelIDStore() { | 633 SQLiteChannelIDStore::~SQLiteChannelIDStore() { |
631 backend_->Close(); | 634 backend_->Close(); |
632 // We release our reference to the Backend, though it will probably still have | 635 // We release our reference to the Backend, though it will probably still have |
633 // a reference if the background task runner has not run Close() yet. | 636 // a reference if the background task runner has not run Close() yet. |
634 } | 637 } |
635 | 638 |
636 } // namespace net | 639 } // namespace net |
OLD | NEW |