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

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

Issue 213263004: Made IndexedDB's comparators public. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "third_party/leveldatabase/src/include/leveldb/comparator.h"
15 #include "third_party/leveldatabase/src/include/leveldb/status.h" 16 #include "third_party/leveldatabase/src/include/leveldb/status.h"
16 17
17 namespace leveldb { 18 namespace leveldb {
18 class Comparator; 19 class Comparator;
19 class DB; 20 class DB;
20 class Env; 21 class Env;
21 class Snapshot; 22 class Snapshot;
22 } 23 }
23 24
24 namespace content { 25 namespace content {
(...skipping 15 matching lines...) Expand all
40 const leveldb::Snapshot* snapshot_; 41 const leveldb::Snapshot* snapshot_;
41 }; 42 };
42 43
43 class CONTENT_EXPORT LevelDBLock { 44 class CONTENT_EXPORT LevelDBLock {
44 public: 45 public:
45 virtual ~LevelDBLock() {} 46 virtual ~LevelDBLock() {}
46 }; 47 };
47 48
48 class CONTENT_EXPORT LevelDBDatabase { 49 class CONTENT_EXPORT LevelDBDatabase {
49 public: 50 public:
51 class ComparatorAdapter : public leveldb::Comparator {
52 public:
53 explicit ComparatorAdapter(const LevelDBComparator* comparator);
54
55 virtual int Compare(const leveldb::Slice& a,
56 const leveldb::Slice& b) const OVERRIDE;
57
58 virtual const char* Name() const OVERRIDE;
59
60 virtual void FindShortestSeparator(std::string* start,
61 const leveldb::Slice& limit) const
62 OVERRIDE;
63 virtual void FindShortSuccessor(std::string* key) const OVERRIDE;
64
65 private:
66 const LevelDBComparator* comparator_;
67 };
68
50 static leveldb::Status Open(const base::FilePath& file_name, 69 static leveldb::Status Open(const base::FilePath& file_name,
51 const LevelDBComparator* comparator, 70 const LevelDBComparator* comparator,
52 scoped_ptr<LevelDBDatabase>* db, 71 scoped_ptr<LevelDBDatabase>* db,
53 bool* is_disk_full = 0); 72 bool* is_disk_full = 0);
54 static scoped_ptr<LevelDBDatabase> OpenInMemory( 73 static scoped_ptr<LevelDBDatabase> OpenInMemory(
55 const LevelDBComparator* comparator); 74 const LevelDBComparator* comparator);
56 static leveldb::Status Destroy(const base::FilePath& file_name); 75 static leveldb::Status Destroy(const base::FilePath& file_name);
57 static scoped_ptr<LevelDBLock> LockForTesting( 76 static scoped_ptr<LevelDBLock> LockForTesting(
58 const base::FilePath& file_name); 77 const base::FilePath& file_name);
59 virtual ~LevelDBDatabase(); 78 virtual ~LevelDBDatabase();
(...skipping 17 matching lines...) Expand all
77 96
78 scoped_ptr<leveldb::Env> env_; 97 scoped_ptr<leveldb::Env> env_;
79 scoped_ptr<leveldb::Comparator> comparator_adapter_; 98 scoped_ptr<leveldb::Comparator> comparator_adapter_;
80 scoped_ptr<leveldb::DB> db_; 99 scoped_ptr<leveldb::DB> db_;
81 const LevelDBComparator* comparator_; 100 const LevelDBComparator* comparator_;
82 }; 101 };
83 102
84 } // namespace content 103 } // namespace content
85 104
86 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ 105 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_backing_store.cc ('k') | content/browser/indexed_db/leveldb/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698