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

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: Delete Range Created 4 years, 6 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
30 // Returns true if this operation performs a change, where the value wasn't
31 // already deleted.
32 bool Remove(const base::StringPiece& key);
30 virtual leveldb::Status Get(const base::StringPiece& key, 33 virtual leveldb::Status Get(const base::StringPiece& key,
31 std::string* value, 34 std::string* value,
32 bool* found); 35 bool* found);
33 virtual leveldb::Status Commit(); 36 virtual leveldb::Status Commit();
34 void Rollback(); 37 void Rollback();
35 38
36 std::unique_ptr<LevelDBIterator> CreateIterator(); 39 std::unique_ptr<LevelDBIterator> CreateIterator();
37 40
38 protected: 41 protected:
39 virtual ~LevelDBTransaction(); 42 virtual ~LevelDBTransaction();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const LevelDBComparator* comparator_; 125 const LevelDBComparator* comparator_;
123 mutable std::unique_ptr<DataIterator> data_iterator_; 126 mutable std::unique_ptr<DataIterator> data_iterator_;
124 std::unique_ptr<LevelDBIterator> db_iterator_; 127 std::unique_ptr<LevelDBIterator> db_iterator_;
125 LevelDBIterator* current_; 128 LevelDBIterator* current_;
126 129
127 Direction direction_; 130 Direction direction_;
128 mutable bool data_changed_; 131 mutable bool data_changed_;
129 132
130 DISALLOW_COPY_AND_ASSIGN(TransactionIterator); 133 DISALLOW_COPY_AND_ASSIGN(TransactionIterator);
131 }; 134 };
132 135 // Returns true if the key was originally marked deleted, false otherwise.
133 void Set(const base::StringPiece& key, std::string* value, bool deleted); 136 bool Set(const base::StringPiece& key, std::string* value, bool deleted);
134 void Clear(); 137 void Clear();
135 void RegisterIterator(TransactionIterator* iterator); 138 void RegisterIterator(TransactionIterator* iterator);
136 void UnregisterIterator(TransactionIterator* iterator); 139 void UnregisterIterator(TransactionIterator* iterator);
137 void NotifyIterators(); 140 void NotifyIterators();
138 141
139 LevelDBDatabase* db_; 142 LevelDBDatabase* db_;
140 const LevelDBSnapshot snapshot_; 143 const LevelDBSnapshot snapshot_;
141 const LevelDBComparator* comparator_; 144 const LevelDBComparator* comparator_;
142 Comparator data_comparator_; 145 Comparator data_comparator_;
143 DataType data_; 146 DataType data_;
(...skipping 23 matching lines...) Expand all
167 LevelDBDatabase* db_; 170 LevelDBDatabase* db_;
168 std::unique_ptr<LevelDBWriteBatch> write_batch_; 171 std::unique_ptr<LevelDBWriteBatch> write_batch_;
169 bool finished_; 172 bool finished_;
170 173
171 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction); 174 DISALLOW_COPY_AND_ASSIGN(LevelDBDirectTransaction);
172 }; 175 };
173 176
174 } // namespace content 177 } // namespace content
175 178
176 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ 179 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_database.cc ('k') | content/browser/indexed_db/leveldb/leveldb_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698