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

Unified Diff: content/browser/media/webrtc_identity_store_backend.cc

Issue 289343005: Do not CHECK on the result of Sql::Statement::Run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/webrtc_identity_store_backend.cc
diff --git a/content/browser/media/webrtc_identity_store_backend.cc b/content/browser/media/webrtc_identity_store_backend.cc
index d599dcda742d08d3ffb80598acabdf432bb5a3d0..d4c518a8cf6f6c5d75146fc3c7444a2fd762a48b 100644
--- a/content/browser/media/webrtc_identity_store_backend.cc
+++ b/content/browser/media/webrtc_identity_store_backend.cc
@@ -343,7 +343,7 @@ void WebRTCIdentityStoreBackend::OnLoaded(scoped_ptr<IdentityMap> out_map) {
if (state_ != LOADING)
return;
- DVLOG(2) << "WebRTC identity store has loaded.";
+ DVLOG(3) << "WebRTC identity store has loaded.";
state_ = LOADED;
identities_.swap(*out_map);
@@ -370,7 +370,7 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::Load(IdentityMap* out_map) {
// from it.
const base::FilePath dir = path_.DirName();
if (!base::PathExists(dir) && !base::CreateDirectory(dir)) {
- DLOG(ERROR) << "Unable to open DB file path.";
+ DVLOG(2) << "Unable to open DB file path.";
return;
}
@@ -379,13 +379,13 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::Load(IdentityMap* out_map) {
db_->set_error_callback(base::Bind(&SqlLiteStorage::OnDatabaseError, this));
if (!db_->Open(path_)) {
- DLOG(ERROR) << "Unable to open DB.";
+ DVLOG(2) << "Unable to open DB.";
db_.reset();
return;
}
if (!InitDB(db_.get())) {
- DLOG(ERROR) << "Unable to init DB.";
+ DVLOG(2) << "Unable to init DB.";
db_.reset();
return;
}
@@ -470,12 +470,17 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::DeleteBetween(
sql::Transaction transaction(db_.get());
if (!transaction.Begin()) {
- DLOG(ERROR) << "Failed to begin the transaction.";
+ DVLOG(2) << "Failed to begin the transaction.";
return;
}
- CHECK(del_stmt.Run());
- transaction.Commit();
+ if (!del_stmt.Run()) {
+ DVLOG(2) << "Failed to run the delete statement.";
+ return;
+ }
+
+ if (!transaction.Commit())
+ DVLOG(2) << "Failed to commit the transaction.";
}
void WebRTCIdentityStoreBackend::SqlLiteStorage::OnDatabaseError(
@@ -484,7 +489,11 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::OnDatabaseError(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
if (!sql::IsErrorCatastrophic(error))
Ami GONE FROM CHROMIUM 2014/05/23 23:05:37 CL description implies that all the things that pr
jiayl 2014/05/23 23:25:40 Changed to always RazeAndClose for "DELETE" failur
return;
+
+ DVLOG(2) << "Database error " << error << " for statement "
+ << stmt->GetSQLStatement();
db_->RazeAndClose();
+ db_.reset();
}
void WebRTCIdentityStoreBackend::SqlLiteStorage::BatchOperation(
@@ -542,7 +551,7 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::Commit() {
sql::Transaction transaction(db_.get());
if (!transaction.Begin()) {
- DLOG(ERROR) << "Failed to begin the transaction.";
+ DVLOG(2) << "Failed to begin the transaction.";
return;
}
@@ -561,14 +570,16 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::Commit() {
const std::string& private_key = po->identity.private_key;
add_stmt.BindBlob(4, private_key.data(), private_key.size());
add_stmt.BindInt64(5, po->identity.creation_time);
- CHECK(add_stmt.Run());
+ if (!add_stmt.Run())
+ DVLOG(2) << "Failed to add the identity to DB.";
Ami GONE FROM CHROMIUM 2014/05/23 23:05:37 return?
jiayl 2014/05/23 23:25:40 Done.
break;
}
case DELETE_IDENTITY:
del_stmt.Reset(true);
del_stmt.BindString(0, po->origin.spec());
del_stmt.BindString(1, po->identity_name);
- CHECK(del_stmt.Run());
+ if (!del_stmt.Run())
+ DVLOG(2) << "Failed to delete the identity from DB.";
Ami GONE FROM CHROMIUM 2014/05/23 23:05:37 ditto
jiayl 2014/05/23 23:25:40 Done.
break;
default:
@@ -576,7 +587,10 @@ void WebRTCIdentityStoreBackend::SqlLiteStorage::Commit() {
break;
}
}
- transaction.Commit();
+
+ if (!transaction.Commit())
+ DVLOG(2) << "Failed to commit the transaction.";
+
pending_operations_.clear();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698