Chromium Code Reviews| Index: content/browser/indexed_db/leveldb/leveldb_transaction.cc |
| diff --git a/content/browser/indexed_db/leveldb/leveldb_transaction.cc b/content/browser/indexed_db/leveldb/leveldb_transaction.cc |
| index a42f3c3da4ff5cfeade3b9c3905a5c043a6575fd..156bab1f45c54195b7b0b68334ffc01a3a9145a4 100644 |
| --- a/content/browser/indexed_db/leveldb/leveldb_transaction.cc |
| +++ b/content/browser/indexed_db/leveldb/leveldb_transaction.cc |
| @@ -29,12 +29,10 @@ LevelDBTransaction::Record::Record() : deleted(false) {} |
| LevelDBTransaction::Record::~Record() {} |
| void LevelDBTransaction::Clear() { |
|
cmumford
2016/08/13 00:08:38
Now only used in LevelDBTransaction::Rollback(). C
jsbell
2016/08/16 03:05:28
Done.
|
| - for (const auto& it : data_) |
| - delete it.second; |
| data_.clear(); |
| } |
| -LevelDBTransaction::~LevelDBTransaction() { Clear(); } |
| +LevelDBTransaction::~LevelDBTransaction() {} |
| bool LevelDBTransaction::Set(const StringPiece& key, |
| std::string* value, |
| @@ -43,11 +41,11 @@ bool LevelDBTransaction::Set(const StringPiece& key, |
| DataType::iterator it = data_.find(key); |
| if (it == data_.end()) { |
| - Record* record = new Record(); |
| + std::unique_ptr<Record> record = base::MakeUnique<Record>(); |
| record->key.assign(key.begin(), key.end() - key.begin()); |
| record->value.swap(*value); |
| record->deleted = deleted; |
| - data_[record->key] = record; |
| + data_[record->key] = std::move(record); |
| NotifyIterators(); |
| return false; |
| } |
| @@ -107,8 +105,6 @@ leveldb::Status LevelDBTransaction::Commit() { |
| write_batch->Put(it->first, it->second->value); |
| else |
| write_batch->Remove(it->first); |
| - |
| - delete it->second; |
| data_.erase(it++); |
| } |