OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" | 5 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/indexed_db/leveldb/leveldb_database.h" | 10 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return s; | 114 return s; |
115 } | 115 } |
116 | 116 |
117 void LevelDBTransaction::Rollback() { | 117 void LevelDBTransaction::Rollback() { |
118 DCHECK(!finished_); | 118 DCHECK(!finished_); |
119 finished_ = true; | 119 finished_ = true; |
120 Clear(); | 120 Clear(); |
121 } | 121 } |
122 | 122 |
123 scoped_ptr<LevelDBIterator> LevelDBTransaction::CreateIterator() { | 123 scoped_ptr<LevelDBIterator> LevelDBTransaction::CreateIterator() { |
124 return TransactionIterator::Create(this).PassAs<LevelDBIterator>(); | 124 return TransactionIterator::Create(this); |
125 } | 125 } |
126 | 126 |
127 scoped_ptr<LevelDBTransaction::DataIterator> | 127 scoped_ptr<LevelDBTransaction::DataIterator> |
128 LevelDBTransaction::DataIterator::Create(LevelDBTransaction* transaction) { | 128 LevelDBTransaction::DataIterator::Create(LevelDBTransaction* transaction) { |
129 return make_scoped_ptr(new DataIterator(transaction)); | 129 return make_scoped_ptr(new DataIterator(transaction)); |
130 } | 130 } |
131 | 131 |
132 bool LevelDBTransaction::DataIterator::IsValid() const { | 132 bool LevelDBTransaction::DataIterator::IsValid() const { |
133 return iterator_ != data_->end(); | 133 return iterator_ != data_->end(); |
134 } | 134 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 485 |
486 leveldb::Status s = db_->Write(*write_batch_); | 486 leveldb::Status s = db_->Write(*write_batch_); |
487 if (s.ok()) { | 487 if (s.ok()) { |
488 finished_ = true; | 488 finished_ = true; |
489 write_batch_->Clear(); | 489 write_batch_->Clear(); |
490 } | 490 } |
491 return s; | 491 return s; |
492 } | 492 } |
493 | 493 |
494 } // namespace content | 494 } // namespace content |
OLD | NEW |