Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: content/browser/indexed_db/leveldb/leveldb_transaction.h

Issue 1996443003: Return number of values deleted by IDBObjectStore.delete(range) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h" 17 #include "content/browser/indexed_db/leveldb/leveldb_comparator.h"
18 #include "content/browser/indexed_db/leveldb/leveldb_database.h" 18 #include "content/browser/indexed_db/leveldb/leveldb_database.h"
19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" 19 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 class LevelDBWriteBatch; 23 class LevelDBWriteBatch;
24 24
25 class CONTENT_EXPORT LevelDBTransaction 25 class CONTENT_EXPORT LevelDBTransaction
26 : public base::RefCounted<LevelDBTransaction> { 26 : public base::RefCounted<LevelDBTransaction> {
27 public: 27 public:
28 void Put(const base::StringPiece& key, std::string* value); 28 void Put(const base::StringPiece& key, std::string* value);
29 void Remove(const base::StringPiece& key); 29 bool Remove(const base::StringPiece& key);
dmurph 2016/05/19 01:01:39 Put a comment here: "Returns true if the record w
palakj1 2016/05/19 23:47:52 Done in header file
30 virtual leveldb::Status Get(const base::StringPiece& key, 30 virtual leveldb::Status Get(const base::StringPiece& key,
31 std::string* value, 31 std::string* value,
32 bool* found); 32 bool* found);
33 virtual leveldb::Status Commit(); 33 virtual leveldb::Status Commit();
34 void Rollback(); 34 void Rollback();
35 35
36 std::unique_ptr<LevelDBIterator> CreateIterator(); 36 std::unique_ptr<LevelDBIterator> CreateIterator();
37 37
38 protected: 38 protected:
39 virtual ~LevelDBTransaction(); 39 virtual ~LevelDBTransaction();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 mutable std::unique_ptr<DataIterator> data_iterator_; 123 mutable std::unique_ptr<DataIterator> data_iterator_;
124 std::unique_ptr<LevelDBIterator> db_iterator_; 124 std::unique_ptr<LevelDBIterator> db_iterator_;
125 LevelDBIterator* current_; 125 LevelDBIterator* current_;
126 126
127 Direction direction_; 127 Direction direction_;
128 mutable bool data_changed_; 128 mutable bool data_changed_;
129 129
130 DISALLOW_COPY_AND_ASSIGN(TransactionIterator); 130 DISALLOW_COPY_AND_ASSIGN(TransactionIterator);
131 }; 131 };
132 132
133 void Set(const base::StringPiece& key, std::string* value, bool deleted);
134 void Clear(); 133 void Clear();
135 void RegisterIterator(TransactionIterator* iterator); 134 void RegisterIterator(TransactionIterator* iterator);
136 void UnregisterIterator(TransactionIterator* iterator); 135 void UnregisterIterator(TransactionIterator* iterator);
137 void NotifyIterators(); 136 void NotifyIterators();
138 137
139 LevelDBDatabase* db_; 138 LevelDBDatabase* db_;
140 const LevelDBSnapshot snapshot_; 139 const LevelDBSnapshot snapshot_;
141 const LevelDBComparator* comparator_; 140 const LevelDBComparator* comparator_;
142 Comparator data_comparator_; 141 Comparator data_comparator_;
143 DataType data_; 142 DataType data_;
(...skipping 23 matching lines...) Expand all
167 LevelDBDatabase* db_; 166 LevelDBDatabase* db_;
168 std::unique_ptr<LevelDBWriteBatch> write_batch_; 167 std::unique_ptr<LevelDBWriteBatch> write_batch_;
169 bool finished_; 168 bool finished_;
170 169
171 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction); 170 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction);
172 }; 171 };
173 172
174 } // namespace content 173 } // namespace content
175 174
176 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ 175 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698