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

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

Issue 15659013: Revert "Migrate the IndexedDB backend from Blink to Chromium" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_
7
8 #include <vector>
9
10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/string16.h"
13 #include "content/common/content_export.h"
14
15 namespace leveldb {
16 class Comparator;
17 class DB;
18 class Env;
19 class Snapshot;
20 }
21
22 namespace content {
23
24 class LevelDBComparator;
25 class LevelDBDatabase;
26 class LevelDBIterator;
27 class LevelDBSlice;
28 class LevelDBWriteBatch;
29
30 class LevelDBSnapshot {
31 private:
32 friend class LevelDBDatabase;
33 friend class LevelDBTransaction;
34
35 explicit LevelDBSnapshot(LevelDBDatabase* db);
36 ~LevelDBSnapshot();
37
38 leveldb::DB* db_;
39 const leveldb::Snapshot* snapshot_;
40 };
41
42 class CONTENT_EXPORT LevelDBDatabase {
43 public:
44 static scoped_ptr<LevelDBDatabase> Open(const base::FilePath& file_name,
45 const LevelDBComparator* comparator);
46 static scoped_ptr<LevelDBDatabase> OpenInMemory(
47 const LevelDBComparator* comparator);
48 static bool Destroy(const base::FilePath& file_name);
49 virtual ~LevelDBDatabase();
50
51 bool Put(const LevelDBSlice& key, const std::vector<char>& value);
52 bool Remove(const LevelDBSlice& key);
53 virtual bool Get(const LevelDBSlice& key,
54 std::vector<char>& value,
55 bool& found,
56 const LevelDBSnapshot* = 0);
57 bool Write(LevelDBWriteBatch& batch);
58 scoped_ptr<LevelDBIterator> CreateIterator(const LevelDBSnapshot* = 0);
59 const LevelDBComparator* Comparator() const;
60
61 protected:
62 LevelDBDatabase();
63
64 private:
65 friend class LevelDBSnapshot;
66
67 scoped_ptr<leveldb::Env> env_;
68 scoped_ptr<leveldb::Comparator> comparator_adapter_;
69 scoped_ptr<leveldb::DB> db_;
70 const LevelDBComparator* comparator_;
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/leveldb/leveldb_comparator.h ('k') | content/browser/indexed_db/leveldb/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698