| 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 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const LevelDBComparator* comparator_; | 66 const LevelDBComparator* comparator_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 typedef std::map<base::StringPiece, Record*, Comparator> DataType; | 69 typedef std::map<base::StringPiece, Record*, Comparator> DataType; |
| 70 | 70 |
| 71 class DataIterator : public LevelDBIterator { | 71 class DataIterator : public LevelDBIterator { |
| 72 public: | 72 public: |
| 73 static scoped_ptr<DataIterator> Create(LevelDBTransaction* transaction); | 73 static scoped_ptr<DataIterator> Create(LevelDBTransaction* transaction); |
| 74 virtual ~DataIterator(); | 74 virtual ~DataIterator(); |
| 75 | 75 |
| 76 virtual bool IsValid() const OVERRIDE; | 76 virtual bool IsValid() const override; |
| 77 virtual leveldb::Status SeekToLast() OVERRIDE; | 77 virtual leveldb::Status SeekToLast() override; |
| 78 virtual leveldb::Status Seek(const base::StringPiece& slice) OVERRIDE; | 78 virtual leveldb::Status Seek(const base::StringPiece& slice) override; |
| 79 virtual leveldb::Status Next() OVERRIDE; | 79 virtual leveldb::Status Next() override; |
| 80 virtual leveldb::Status Prev() OVERRIDE; | 80 virtual leveldb::Status Prev() override; |
| 81 virtual base::StringPiece Key() const OVERRIDE; | 81 virtual base::StringPiece Key() const override; |
| 82 virtual base::StringPiece Value() const OVERRIDE; | 82 virtual base::StringPiece Value() const override; |
| 83 bool IsDeleted() const; | 83 bool IsDeleted() const; |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 explicit DataIterator(LevelDBTransaction* transaction); | 86 explicit DataIterator(LevelDBTransaction* transaction); |
| 87 DataType* data_; | 87 DataType* data_; |
| 88 DataType::iterator iterator_; | 88 DataType::iterator iterator_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(DataIterator); | 90 DISALLOW_COPY_AND_ASSIGN(DataIterator); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 class TransactionIterator : public LevelDBIterator { | 93 class TransactionIterator : public LevelDBIterator { |
| 94 public: | 94 public: |
| 95 virtual ~TransactionIterator(); | 95 virtual ~TransactionIterator(); |
| 96 static scoped_ptr<TransactionIterator> Create( | 96 static scoped_ptr<TransactionIterator> Create( |
| 97 scoped_refptr<LevelDBTransaction> transaction); | 97 scoped_refptr<LevelDBTransaction> transaction); |
| 98 | 98 |
| 99 virtual bool IsValid() const OVERRIDE; | 99 virtual bool IsValid() const override; |
| 100 virtual leveldb::Status SeekToLast() OVERRIDE; | 100 virtual leveldb::Status SeekToLast() override; |
| 101 virtual leveldb::Status Seek(const base::StringPiece& target) OVERRIDE; | 101 virtual leveldb::Status Seek(const base::StringPiece& target) override; |
| 102 virtual leveldb::Status Next() OVERRIDE; | 102 virtual leveldb::Status Next() override; |
| 103 virtual leveldb::Status Prev() OVERRIDE; | 103 virtual leveldb::Status Prev() override; |
| 104 virtual base::StringPiece Key() const OVERRIDE; | 104 virtual base::StringPiece Key() const override; |
| 105 virtual base::StringPiece Value() const OVERRIDE; | 105 virtual base::StringPiece Value() const override; |
| 106 void DataChanged(); | 106 void DataChanged(); |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 enum Direction { FORWARD, REVERSE }; | 109 enum Direction { FORWARD, REVERSE }; |
| 110 | 110 |
| 111 explicit TransactionIterator(scoped_refptr<LevelDBTransaction> transaction); | 111 explicit TransactionIterator(scoped_refptr<LevelDBTransaction> transaction); |
| 112 void HandleConflictsAndDeletes(); | 112 void HandleConflictsAndDeletes(); |
| 113 void SetCurrentIteratorToSmallestKey(); | 113 void SetCurrentIteratorToSmallestKey(); |
| 114 void SetCurrentIteratorToLargestKey(); | 114 void SetCurrentIteratorToLargestKey(); |
| 115 void RefreshDataIterator() const; | 115 void RefreshDataIterator() const; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 LevelDBDatabase* db_; | 165 LevelDBDatabase* db_; |
| 166 scoped_ptr<LevelDBWriteBatch> write_batch_; | 166 scoped_ptr<LevelDBWriteBatch> write_batch_; |
| 167 bool finished_; | 167 bool finished_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction); | 169 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace content | 172 } // namespace content |
| 173 | 173 |
| 174 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ | 174 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ |
| OLD | NEW |