diff options
Diffstat (limited to 'Source/WebCore/platform/leveldb')
4 files changed, 10 insertions, 41 deletions
diff --git a/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp b/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp index edf9db257..273afd4de 100644 --- a/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp +++ b/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp @@ -89,17 +89,6 @@ private: const LevelDBComparator* m_comparator; }; -LevelDBSnapshot::LevelDBSnapshot(LevelDBDatabase* db) - : m_db(db->m_db.get()) - , m_snapshot(m_db->GetSnapshot()) -{ -} - -LevelDBSnapshot::~LevelDBSnapshot() -{ - m_db->ReleaseSnapshot(m_snapshot); -} - LevelDBDatabase::LevelDBDatabase() { } @@ -198,12 +187,11 @@ bool LevelDBDatabase::remove(const LevelDBSlice& key) return false; } -bool LevelDBDatabase::get(const LevelDBSlice& key, Vector<char>& value, const LevelDBSnapshot* snapshot) +bool LevelDBDatabase::get(const LevelDBSlice& key, Vector<char>& value) { std::string result; leveldb::ReadOptions readOptions; readOptions.verify_checksums = true; // FIXME: Disable this if the performance impact is too great. - readOptions.snapshot = snapshot ? snapshot->m_snapshot : 0; const leveldb::Status s = m_db->Get(readOptions, makeSlice(key), &result); if (s.ok()) { @@ -305,11 +293,10 @@ LevelDBSlice IteratorImpl::value() const return makeLevelDBSlice(m_iterator->value()); } -PassOwnPtr<LevelDBIterator> LevelDBDatabase::createIterator(const LevelDBSnapshot* snapshot) +PassOwnPtr<LevelDBIterator> LevelDBDatabase::createIterator() { leveldb::ReadOptions readOptions; readOptions.verify_checksums = true; // FIXME: Disable this if the performance impact is too great. - readOptions.snapshot = snapshot ? snapshot->m_snapshot : 0; OwnPtr<leveldb::Iterator> i = adoptPtr(m_db->NewIterator(readOptions)); if (!i) // FIXME: Double check if we actually need to check this. return nullptr; diff --git a/Source/WebCore/platform/leveldb/LevelDBDatabase.h b/Source/WebCore/platform/leveldb/LevelDBDatabase.h index 2d32cd736..e80b49a24 100644 --- a/Source/WebCore/platform/leveldb/LevelDBDatabase.h +++ b/Source/WebCore/platform/leveldb/LevelDBDatabase.h @@ -37,29 +37,15 @@ namespace leveldb { class Comparator; class DB; class Env; -class Snapshot; } namespace WebCore { class LevelDBComparator; -class LevelDBDatabase; class LevelDBIterator; class LevelDBSlice; class LevelDBWriteBatch; -class LevelDBSnapshot { -private: - friend class LevelDBDatabase; - friend class LevelDBTransaction; - - explicit LevelDBSnapshot(LevelDBDatabase*); - ~LevelDBSnapshot(); - - leveldb::DB* m_db; - const leveldb::Snapshot* m_snapshot; -}; - class LevelDBDatabase { public: static PassOwnPtr<LevelDBDatabase> open(const String& fileName, const LevelDBComparator*); @@ -69,13 +55,12 @@ public: bool put(const LevelDBSlice& key, const Vector<char>& value); bool remove(const LevelDBSlice& key); - bool get(const LevelDBSlice& key, Vector<char>& value, const LevelDBSnapshot* = 0); + bool get(const LevelDBSlice& key, Vector<char>& value); bool write(LevelDBWriteBatch&); - PassOwnPtr<LevelDBIterator> createIterator(const LevelDBSnapshot* = 0); + PassOwnPtr<LevelDBIterator> createIterator(); const LevelDBComparator* comparator() const; private: - friend class LevelDBSnapshot; LevelDBDatabase(); OwnPtr<leveldb::Env> m_env; diff --git a/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp b/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp index fe8262a24..bf5ccbb7f 100644 --- a/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp +++ b/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp @@ -26,13 +26,12 @@ #include "config.h" #include "LevelDBTransaction.h" -#if ENABLE(INDEXED_DATABASE) -#if USE(LEVELDB) - #include "LevelDBDatabase.h" #include "LevelDBSlice.h" #include "LevelDBWriteBatch.h" -#include <leveldb/db.h> + +#if ENABLE(INDEXED_DATABASE) +#if USE(LEVELDB) namespace WebCore { @@ -43,7 +42,6 @@ PassRefPtr<LevelDBTransaction> LevelDBTransaction::create(LevelDBDatabase* db) LevelDBTransaction::LevelDBTransaction(LevelDBDatabase* db) : m_db(db) - , m_snapshot(db) , m_comparator(db->comparator()) , m_finished(false) { @@ -120,7 +118,7 @@ bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value) return true; } - return m_db->get(key, value, &m_snapshot); + return m_db->get(key, value); } bool LevelDBTransaction::commit() @@ -259,7 +257,7 @@ LevelDBTransaction::TransactionIterator::TransactionIterator(PassRefPtr<LevelDBT : m_transaction(transaction) , m_comparator(m_transaction->m_comparator) , m_treeIterator(TreeIterator::create(m_transaction.get())) - , m_dbIterator(m_transaction->m_db->createIterator(&m_transaction->m_snapshot)) + , m_dbIterator(m_transaction->m_db->createIterator()) , m_current(0) , m_direction(kForward) , m_treeChanged(false) diff --git a/Source/WebCore/platform/leveldb/LevelDBTransaction.h b/Source/WebCore/platform/leveldb/LevelDBTransaction.h index 94236ff76..85b734ff0 100644 --- a/Source/WebCore/platform/leveldb/LevelDBTransaction.h +++ b/Source/WebCore/platform/leveldb/LevelDBTransaction.h @@ -30,7 +30,6 @@ #if USE(LEVELDB) #include "LevelDBComparator.h" -#include "LevelDBDatabase.h" #include "LevelDBIterator.h" #include "LevelDBSlice.h" #include <wtf/AVLTree.h> @@ -43,6 +42,7 @@ namespace WebCore { +class LevelDBDatabase; class LevelDBWriteBatch; using WTF::AVLTree; @@ -164,7 +164,6 @@ private: void notifyIteratorsOfTreeChange(); LevelDBDatabase* m_db; - const LevelDBSnapshot m_snapshot; const LevelDBComparator* m_comparator; TreeType m_tree; bool m_finished; |