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

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

Issue 18075008: IndexedDB: Switch key/value handling from vector<char> to std::string (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_WRITE_BATCH_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_
6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_piece.h"
9 10
10 namespace leveldb { 11 namespace leveldb {
11 class WriteBatch; 12 class WriteBatch;
12 } 13 }
13 14
14 namespace content { 15 namespace content {
15 16
16 class LevelDBSlice;
17
18 // Wrapper around leveldb::WriteBatch. 17 // Wrapper around leveldb::WriteBatch.
19 // This class holds a collection of updates to apply atomically to a database. 18 // This class holds a collection of updates to apply atomically to a database.
20 class LevelDBWriteBatch { 19 class LevelDBWriteBatch {
21 public: 20 public:
22 static scoped_ptr<LevelDBWriteBatch> Create(); 21 static scoped_ptr<LevelDBWriteBatch> Create();
23 ~LevelDBWriteBatch(); 22 ~LevelDBWriteBatch();
24 23
25 void Put(const LevelDBSlice& key, const LevelDBSlice& value); 24 void Put(const base::StringPiece& key, const base::StringPiece& value);
26 void Remove(const LevelDBSlice& key); // Add remove operation to the batch. 25 void Remove(const base::StringPiece& key); // Add remove operation to the
26 // batch.
27 void Clear(); 27 void Clear();
28 28
29 private: 29 private:
30 friend class LevelDBDatabase; 30 friend class LevelDBDatabase;
31 LevelDBWriteBatch(); 31 LevelDBWriteBatch();
32 32
33 scoped_ptr<leveldb::WriteBatch> write_batch_; 33 scoped_ptr<leveldb::WriteBatch> write_batch_;
34 }; 34 };
35 35
36 } // namespace content 36 } // namespace content
37 37
38 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_ 38 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_WRITE_BATCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698