| 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 <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "content/browser/indexed_db/leveldb/avltree.h" | 13 #include "content/browser/indexed_db/leveldb/avltree.h" |
| 14 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" | 14 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" |
| 15 #include "content/browser/indexed_db/leveldb/leveldb_database.h" | 15 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
| 16 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 16 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
| 17 #include "content/browser/indexed_db/leveldb/leveldb_slice.h" | 17 #include "content/browser/indexed_db/leveldb/leveldb_slice.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class LevelDBWriteBatch; | 21 class LevelDBWriteBatch; |
| 22 | 22 |
| 23 class CONTENT_EXPORT LevelDBTransaction | 23 class CONTENT_EXPORT LevelDBTransaction |
| 24 : public base::RefCounted<LevelDBTransaction> { | 24 : public base::RefCounted<LevelDBTransaction> { |
| 25 public: | 25 public: |
| 26 static scoped_refptr<LevelDBTransaction> Create(LevelDBDatabase* db); | 26 static scoped_refptr<LevelDBTransaction> Create(LevelDBDatabase* db); |
| 27 | 27 |
| 28 void Put(const LevelDBSlice& key, const std::vector<char>& value); | 28 void Put(const LevelDBSlice& key, const std::vector<char>& value); |
| 29 void Remove(const LevelDBSlice& key); | 29 void Remove(const LevelDBSlice& key); |
| 30 bool Get(const LevelDBSlice& key, std::vector<char>& value, bool& found); | 30 bool Get(const LevelDBSlice& key, std::string* value, bool& found); |
| 31 bool Commit(); | 31 bool Commit(); |
| 32 void Rollback(); | 32 void Rollback(); |
| 33 | 33 |
| 34 scoped_ptr<LevelDBIterator> CreateIterator(); | 34 scoped_ptr<LevelDBIterator> CreateIterator(); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 explicit LevelDBTransaction(LevelDBDatabase* db); | 37 explicit LevelDBTransaction(LevelDBDatabase* db); |
| 38 virtual ~LevelDBTransaction(); | 38 virtual ~LevelDBTransaction(); |
| 39 friend class base::RefCounted<LevelDBTransaction>; | 39 friend class base::RefCounted<LevelDBTransaction>; |
| 40 | 40 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 explicit LevelDBWriteOnlyTransaction(LevelDBDatabase* db); | 170 explicit LevelDBWriteOnlyTransaction(LevelDBDatabase* db); |
| 171 | 171 |
| 172 LevelDBDatabase* db_; | 172 LevelDBDatabase* db_; |
| 173 scoped_ptr<LevelDBWriteBatch> write_batch_; | 173 scoped_ptr<LevelDBWriteBatch> write_batch_; |
| 174 bool finished_; | 174 bool finished_; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 } // namespace content | 177 } // namespace content |
| 178 | 178 |
| 179 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ | 179 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ |
| OLD | NEW |