Chromium Code Reviews| Index: chrome/browser/net/sqlite_origin_bound_cert_store.cc |
| diff --git a/chrome/browser/net/sqlite_origin_bound_cert_store.cc b/chrome/browser/net/sqlite_origin_bound_cert_store.cc |
| index 9c6538e26704086bebf7afd2c9c386d67a7c1881..f737d65903acf19a7f48af092801fa6813b4e104 100644 |
| --- a/chrome/browser/net/sqlite_origin_bound_cert_store.cc |
| +++ b/chrome/browser/net/sqlite_origin_bound_cert_store.cc |
| @@ -176,8 +176,7 @@ bool SQLiteOriginBoundCertStore::Backend::Load( |
| sql::Statement smt(db_->GetUniqueStatement( |
| "SELECT origin, private_key, cert, cert_type, expiration_time, " |
| "creation_time FROM origin_bound_certs")); |
| - if (!smt) { |
| - NOTREACHED() << "select statement prep failed"; |
| + if (!smt.is_valid()) { |
| db_.reset(); |
| return false; |
| } |
| @@ -245,7 +244,7 @@ bool SQLiteOriginBoundCertStore::Backend::EnsureDatabaseVersion() { |
| if (!db_->Execute("ALTER TABLE origin_bound_certs ADD COLUMN " |
| "expiration_time INTEGER")) { |
| LOG(WARNING) << "Unable to update origin bound cert database to " |
| - << "version 4."; |
| + << "version 3."; |
|
Scott Hess - ex-Googler
2012/02/14 00:28:18
But now this is back to wtc's earlier comment that
Greg Billock
2012/02/14 01:13:44
My head hurts on this -- it looks like we're upgra
Scott Hess - ex-Googler
2012/02/14 01:28:36
My theory is that at some point someone added the
|
| return false; |
| } |
| } |
| @@ -263,11 +262,15 @@ bool SQLiteOriginBoundCertStore::Backend::EnsureDatabaseVersion() { |
| "UPDATE origin_bound_certs SET expiration_time = ? WHERE origin = ?")); |
| sql::Statement update_creation_smt(db_->GetUniqueStatement( |
| "UPDATE origin_bound_certs SET creation_time = ? WHERE origin = ?")); |
| - if (!smt || !update_expires_smt || !update_creation_smt) { |
| + if (!smt.is_valid() || |
| + !update_expires_smt.is_valid() || |
| + !update_creation_smt.is_valid()) { |
| LOG(WARNING) << "Unable to update origin bound cert database to " |
| << "version 4."; |
| return false; |
| } |
| + |
| + |
| while (smt.Step()) { |
| std::string origin = smt.ColumnString(0); |
| std::string cert_from_db; |
| @@ -284,7 +287,7 @@ bool SQLiteOriginBoundCertStore::Backend::EnsureDatabaseVersion() { |
| update_expires_smt.BindString(1, origin); |
| if (!update_expires_smt.Run()) { |
| LOG(WARNING) << "Unable to update origin bound cert database to " |
| - << "version 4."; |
| + << "version 3."; |
|
Scott Hess - ex-Googler
2012/02/14 00:28:18
And this one to version 4.
Greg Billock
2012/02/14 01:13:44
Done.
|
| return false; |
| } |
| } |
| @@ -382,23 +385,18 @@ void SQLiteOriginBoundCertStore::Backend::Commit() { |
| sql::Statement add_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| "INSERT INTO origin_bound_certs (origin, private_key, cert, cert_type, " |
| "expiration_time) VALUES (?,?,?,?,?)")); |
| - if (!add_smt) { |
| - NOTREACHED(); |
| + if (!add_smt.is_valid()) |
| return; |
| - } |
| sql::Statement del_smt(db_->GetCachedStatement(SQL_FROM_HERE, |
| "DELETE FROM origin_bound_certs WHERE origin=?")); |
| - if (!del_smt) { |
| - NOTREACHED(); |
| + if (!del_smt.is_valid()) |
| return; |
| - } |
| sql::Transaction transaction(db_.get()); |
| - if (!transaction.Begin()) { |
| - NOTREACHED(); |
| + if (!transaction.Begin()) |
| return; |
| - } |
| + |
| for (PendingOperationsList::iterator it = ops.begin(); |
| it != ops.end(); ++it) { |
| // Free the certs as we commit them to the database. |