diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 20:18:16 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 20:18:16 +0000 |
commit | 4ab952fe9107033ac12a973cd599a7bdb9bcb57a (patch) | |
tree | fa1ecc86d007ba6a3a7f2ec8259ed69fb5ea4521 /sql/transaction.cc | |
parent | 9a1d0d7f92dd754a4b29f8bd507a7cbeabce1c71 (diff) | |
download | chromium_src-4ab952fe9107033ac12a973cd599a7bdb9bcb57a.zip chromium_src-4ab952fe9107033ac12a973cd599a7bdb9bcb57a.tar.gz chromium_src-4ab952fe9107033ac12a973cd599a7bdb9bcb57a.tar.bz2 |
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
R=shess@chromium.org
Review URL: https://codereview.chromium.org/217613002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r-- | sql/transaction.cc | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc index 06bcbeb..af4b9f8 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -20,30 +20,21 @@ Transaction::~Transaction() { } 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(); } |