Misc. cleanup found while mucking with search engines code:
* Don't handle DCHECK failure
* Remove NOTREACHED()/LOG(ERROR) from cases that look like they could
legitimately happen
* All lines of args should begin at the same position
* WebDataService::SetDefaultSearchProvider() doesn't actually need a full
TemplateURL, just an ID
* Use GetCachedStatement correctly, and in more places
* Make KeywordTableTest a friend of KeywordTable to reduce FRIEND_TEST
declarations and in preparation for making Add/Update/RemoveKeyword private
* Data members should be private, not protected
* Function declarations: all args on first line or one arg per line
* Fix misspelling
BUG=none
TEST=none
[email protected]
Review URL: https://codereview.chromium.org/217613002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260933 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 06bcbebe..af4b9f89 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -20,30 +20,21 @@
}
bool Transaction::Begin() {
- if (is_open_) {
- NOTREACHED() << "Beginning a transaction twice!";
- return false;
- }
+ DCHECK(!is_open_) << "Beginning a transaction twice!";
is_open_ = connection_->BeginTransaction();
return is_open_;
}
void Transaction::Rollback() {
- if (!is_open_) {
- NOTREACHED() << "Attempting to roll back a nonexistent transaction. "
- << "Did you remember to call Begin() and check its return?";
- return;
- }
+ DCHECK(is_open_) << "Attempting to roll back a nonexistent transaction. "
+ << "Did you remember to call Begin() and check its return?";
is_open_ = false;
connection_->RollbackTransaction();
}
bool Transaction::Commit() {
- if (!is_open_) {
- NOTREACHED() << "Attempting to commit a nonexistent transaction. "
- << "Did you remember to call Begin() and check its return?";
- return false;
- }
+ DCHECK(is_open_) << "Attempting to commit a nonexistent transaction. "
+ << "Did you remember to call Begin() and check its return?";
is_open_ = false;
return connection_->CommitTransaction();
}