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> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" | 16 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" |
17 #include "content/browser/indexed_db/leveldb/leveldb_database.h" | 17 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
18 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" | 18 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class LevelDBWriteBatch; | 22 class LevelDBWriteBatch; |
23 | 23 |
24 class CONTENT_EXPORT LevelDBTransaction | 24 class CONTENT_EXPORT LevelDBTransaction |
25 : public base::RefCounted<LevelDBTransaction> { | 25 : public base::RefCounted<LevelDBTransaction> { |
26 public: | 26 public: |
27 | |
28 void Put(const base::StringPiece& key, std::string* value); | 27 void Put(const base::StringPiece& key, std::string* value); |
29 void Remove(const base::StringPiece& key); | 28 void Remove(const base::StringPiece& key); |
30 virtual leveldb::Status Get(const base::StringPiece& key, | 29 virtual leveldb::Status Get(const base::StringPiece& key, |
31 std::string* value, | 30 std::string* value, |
32 bool* found); | 31 bool* found); |
33 virtual leveldb::Status Commit(); | 32 virtual leveldb::Status Commit(); |
34 void Rollback(); | 33 void Rollback(); |
35 | 34 |
36 scoped_ptr<LevelDBIterator> CreateIterator(); | 35 scoped_ptr<LevelDBIterator> CreateIterator(); |
37 | 36 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 LevelDBDatabase* db_; | 167 LevelDBDatabase* db_; |
169 scoped_ptr<LevelDBWriteBatch> write_batch_; | 168 scoped_ptr<LevelDBWriteBatch> write_batch_; |
170 bool finished_; | 169 bool finished_; |
171 | 170 |
172 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction); | 171 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction); |
173 }; | 172 }; |
174 | 173 |
175 } // namespace content | 174 } // namespace content |
176 | 175 |
177 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ | 176 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ |
OLD | NEW |