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

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

Issue 19117005: IndexedDB: Coding conventions and cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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 <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "content/browser/indexed_db/leveldb/avltree.h" 15 #include "content/browser/indexed_db/leveldb/avltree.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 static scoped_refptr<LevelDBTransaction> Create(LevelDBDatabase* db); 27 explicit LevelDBTransaction(LevelDBDatabase* db);
28 28
29 void Put(const base::StringPiece& key, std::string* value); 29 void Put(const base::StringPiece& key, std::string* value);
30 void Remove(const base::StringPiece& key); 30 void Remove(const base::StringPiece& key);
31 bool Get(const base::StringPiece& key, std::string* value, bool* found); 31 bool Get(const base::StringPiece& key, std::string* value, bool* found);
32 bool Commit(); 32 bool Commit();
33 void Rollback(); 33 void Rollback();
34 34
35 scoped_ptr<LevelDBIterator> CreateIterator(); 35 scoped_ptr<LevelDBIterator> CreateIterator();
36 36
37 private: 37 private:
38 explicit LevelDBTransaction(LevelDBDatabase* db);
39 virtual ~LevelDBTransaction(); 38 virtual ~LevelDBTransaction();
40 friend class base::RefCounted<LevelDBTransaction>; 39 friend class base::RefCounted<LevelDBTransaction>;
41 40
42 struct AVLTreeNode { 41 struct AVLTreeNode {
43 AVLTreeNode(); 42 AVLTreeNode();
44 ~AVLTreeNode(); 43 ~AVLTreeNode();
45 std::string key; 44 std::string key;
46 std::string value; 45 std::string value;
47 bool deleted; 46 bool deleted;
48 47
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 explicit LevelDBWriteOnlyTransaction(LevelDBDatabase* db); 168 explicit LevelDBWriteOnlyTransaction(LevelDBDatabase* db);
170 169
171 LevelDBDatabase* db_; 170 LevelDBDatabase* db_;
172 scoped_ptr<LevelDBWriteBatch> write_batch_; 171 scoped_ptr<LevelDBWriteBatch> write_batch_;
173 bool finished_; 172 bool finished_;
174 }; 173 };
175 174
176 } // namespace content 175 } // namespace content
177 176
178 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_ 177 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698