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

Unified Diff: chrome/browser/net/sqlite_origin_bound_cert_store.cc

Issue 9365030: More SQL statement usage regularization. Back-touch some (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/safari_importer.mm ('k') | chrome/browser/net/sqlite_persistent_cookie_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8ca55c2b18b1ceb6e8c98127a0793f7db2d9da54..47bec7bfe5aa92e085c5c8e402953189c3b6c84f 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;
}
@@ -263,11 +262,14 @@ 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;
@@ -382,23 +384,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, creation_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.
« no previous file with comments | « chrome/browser/importer/safari_importer.mm ('k') | chrome/browser/net/sqlite_persistent_cookie_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698