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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 RefreshDataIterator(); | 356 RefreshDataIterator(); |
357 return current_->Key(); | 357 return current_->Key(); |
358 } | 358 } |
359 | 359 |
360 StringPiece LevelDBTransaction::TransactionIterator::Value() const { | 360 StringPiece LevelDBTransaction::TransactionIterator::Value() const { |
361 DCHECK(IsValid()); | 361 DCHECK(IsValid()); |
362 if (data_changed_) | 362 if (data_changed_) |
363 RefreshDataIterator(); | 363 RefreshDataIterator(); |
364 return current_->Value(); | 364 return current_->Value(); |
365 } | 365 } |
| 366 bool LevelDBTransaction::TransactionIterator::IsDetached() const { |
| 367 return db_iterator_->IsDetached(); |
| 368 } |
366 | 369 |
367 void LevelDBTransaction::TransactionIterator::DataChanged() { | 370 void LevelDBTransaction::TransactionIterator::DataChanged() { |
368 data_changed_ = true; | 371 data_changed_ = true; |
369 } | 372 } |
370 | 373 |
371 void LevelDBTransaction::TransactionIterator::Delete() { | 374 void LevelDBTransaction::TransactionIterator::Delete() { |
372 DCHECK(IsValid()); | 375 DCHECK(IsValid()); |
373 if (current_ == data_iterator_.get()) { | 376 if (current_ == data_iterator_.get()) { |
374 data_iterator_->Delete(); | 377 data_iterator_->Delete(); |
375 } else { | 378 } else { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 539 |
537 leveldb::Status s = db_->Write(*write_batch_); | 540 leveldb::Status s = db_->Write(*write_batch_); |
538 if (s.ok()) { | 541 if (s.ok()) { |
539 finished_ = true; | 542 finished_ = true; |
540 write_batch_->Clear(); | 543 write_batch_->Clear(); |
541 } | 544 } |
542 return s; | 545 return s; |
543 } | 546 } |
544 | 547 |
545 } // namespace content | 548 } // namespace content |
OLD | NEW |