|
Lines 898-904
WARN_UNUSED_RETURN static bool getNewVersionNumber(LevelDBTransaction* transacti
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec1
|
| 898 |
return true; |
898 |
return true; |
| 899 |
} |
899 |
} |
| 900 |
|
900 |
|
| 901 |
bool IDBBackingStoreLevelDB::putRecord(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, PassRefPtr<SharedBuffer> prpValue, IDBBackingStoreInterface::RecordIdentifier* recordIdentifier) |
901 |
bool IDBBackingStoreLevelDB::putRecord(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, PassRefPtr<SharedBuffer> prpValue, IDBRecordIdentifier* recordIdentifier) |
| 902 |
{ |
902 |
{ |
| 903 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::putRecord"); |
903 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::putRecord"); |
| 904 |
if (!KeyPrefix::validIds(databaseId, objectStoreId)) |
904 |
if (!KeyPrefix::validIds(databaseId, objectStoreId)) |
|
Lines 941-957
bool IDBBackingStoreLevelDB::clearObjectStore(IDBBackingStoreInterface::Transact
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec2
|
| 941 |
return true; |
941 |
return true; |
| 942 |
} |
942 |
} |
| 943 |
|
943 |
|
| 944 |
bool IDBBackingStoreLevelDB::deleteRecord(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBBackingStoreInterface::RecordIdentifier& recordIdentifier) |
944 |
bool IDBBackingStoreLevelDB::deleteRecord(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBRecordIdentifier& recordIdentifier) |
| 945 |
{ |
945 |
{ |
| 946 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::deleteRecord"); |
946 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::deleteRecord"); |
|
|
947 |
|
| 947 |
if (!KeyPrefix::validIds(databaseId, objectStoreId)) |
948 |
if (!KeyPrefix::validIds(databaseId, objectStoreId)) |
| 948 |
return false; |
949 |
return false; |
| 949 |
LevelDBTransaction* levelDBTransaction = IDBBackingStoreLevelDB::Transaction::levelDBTransactionFrom(transaction); |
950 |
LevelDBTransaction* levelDBTransaction = IDBBackingStoreLevelDB::Transaction::levelDBTransactionFrom(transaction); |
| 950 |
|
951 |
|
| 951 |
const Vector<char> objectStoreDataKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, recordIdentifier.primaryKey()); |
952 |
const Vector<char> objectStoreDataKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, recordIdentifier.encodedPrimaryKey()); |
| 952 |
levelDBTransaction->remove(objectStoreDataKey); |
953 |
levelDBTransaction->remove(objectStoreDataKey); |
| 953 |
|
954 |
|
| 954 |
const Vector<char> existsEntryKey = ExistsEntryKey::encode(databaseId, objectStoreId, recordIdentifier.primaryKey()); |
955 |
const Vector<char> existsEntryKey = ExistsEntryKey::encode(databaseId, objectStoreId, recordIdentifier.encodedPrimaryKey()); |
| 955 |
levelDBTransaction->remove(existsEntryKey); |
956 |
levelDBTransaction->remove(existsEntryKey); |
| 956 |
return true; |
957 |
return true; |
| 957 |
} |
958 |
} |
|
Lines 1027-1038
bool IDBBackingStoreLevelDB::maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStor
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec3
|
| 1027 |
return true; |
1028 |
return true; |
| 1028 |
} |
1029 |
} |
| 1029 |
|
1030 |
|
| 1030 |
bool IDBBackingStoreLevelDB::keyExistsInObjectStore(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, IDBBackingStoreInterface::RecordIdentifier* foundRecordIdentifier, bool& found) |
1031 |
bool IDBBackingStoreLevelDB::keyExistsInObjectStore(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, RefPtr<IDBRecordIdentifier>& foundIDBRecordIdentifier) |
| 1031 |
{ |
1032 |
{ |
| 1032 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::keyExistsInObjectStore"); |
1033 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::keyExistsInObjectStore"); |
| 1033 |
if (!KeyPrefix::validIds(databaseId, objectStoreId)) |
1034 |
if (!KeyPrefix::validIds(databaseId, objectStoreId)) |
| 1034 |
return false; |
1035 |
return false; |
| 1035 |
found = false; |
1036 |
bool found = false; |
| 1036 |
LevelDBTransaction* levelDBTransaction = IDBBackingStoreLevelDB::Transaction::levelDBTransactionFrom(transaction); |
1037 |
LevelDBTransaction* levelDBTransaction = IDBBackingStoreLevelDB::Transaction::levelDBTransactionFrom(transaction); |
| 1037 |
const Vector<char> leveldbKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, key); |
1038 |
const Vector<char> leveldbKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, key); |
| 1038 |
Vector<char> data; |
1039 |
Vector<char> data; |
|
Lines 1049-1055
bool IDBBackingStoreLevelDB::keyExistsInObjectStore(IDBBackingStoreInterface::Tr
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec4
|
| 1049 |
if (!decodeVarInt(data.begin(), data.end(), version)) |
1050 |
if (!decodeVarInt(data.begin(), data.end(), version)) |
| 1050 |
return false; |
1051 |
return false; |
| 1051 |
|
1052 |
|
| 1052 |
foundRecordIdentifier->reset(encodeIDBKey(key), version); |
1053 |
foundIDBRecordIdentifier = IDBRecordIdentifier::create(encodeIDBKey(key), version); |
| 1053 |
return true; |
1054 |
return true; |
| 1054 |
} |
1055 |
} |
| 1055 |
|
1056 |
|
|
Lines 1186-1204
bool IDBBackingStoreLevelDB::deleteIndex(IDBBackingStoreInterface::Transaction*
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec5
|
| 1186 |
return true; |
1187 |
return true; |
| 1187 |
} |
1188 |
} |
| 1188 |
|
1189 |
|
| 1189 |
bool IDBBackingStoreLevelDB::putIndexDataForRecord(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const IDBBackingStoreInterface::RecordIdentifier& recordIdentifier) |
1190 |
bool IDBBackingStoreLevelDB::putIndexDataForRecord(IDBBackingStoreInterface::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey& key, const IDBRecordIdentifier* recordIdentifier) |
| 1190 |
{ |
1191 |
{ |
| 1191 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::putIndexDataForRecord"); |
1192 |
LOG(StorageAPI, "IDBBackingStoreLevelDB::putIndexDataForRecord"); |
| 1192 |
ASSERT(key.isValid()); |
1193 |
ASSERT(key.isValid()); |
|
|
1194 |
ASSERT(recordIdentifier); |
| 1193 |
if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId)) |
1195 |
if (!KeyPrefix::validIds(databaseId, objectStoreId, indexId)) |
| 1194 |
return false; |
1196 |
return false; |
| 1195 |
|
1197 |
|
| 1196 |
LevelDBTransaction* levelDBTransaction = IDBBackingStoreLevelDB::Transaction::levelDBTransactionFrom(transaction); |
1198 |
LevelDBTransaction* levelDBTransaction = IDBBackingStoreLevelDB::Transaction::levelDBTransactionFrom(transaction); |
| 1197 |
const Vector<char> indexDataKey = IndexDataKey::encode(databaseId, objectStoreId, indexId, encodeIDBKey(key), recordIdentifier.primaryKey()); |
1199 |
const Vector<char> indexDataKey = IndexDataKey::encode(databaseId, objectStoreId, indexId, encodeIDBKey(key), recordIdentifier->encodedPrimaryKey()); |
| 1198 |
|
1200 |
|
| 1199 |
Vector<char> data; |
1201 |
Vector<char> data; |
| 1200 |
data.appendVector(encodeVarInt(recordIdentifier.version())); |
1202 |
data.appendVector(encodeVarInt(recordIdentifier->version())); |
| 1201 |
data.appendVector(recordIdentifier.primaryKey()); |
1203 |
data.appendVector(recordIdentifier->encodedPrimaryKey()); |
| 1202 |
|
1204 |
|
| 1203 |
levelDBTransaction->put(indexDataKey, data); |
1205 |
levelDBTransaction->put(indexDataKey, data); |
| 1204 |
return true; |
1206 |
return true; |
|
Lines 1336-1341
IDBBackingStoreLevelDB::Cursor::Cursor(const IDBBackingStoreLevelDB::Cursor* oth
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec6
|
| 1336 |
: m_transaction(other->m_transaction) |
1338 |
: m_transaction(other->m_transaction) |
| 1337 |
, m_cursorOptions(other->m_cursorOptions) |
1339 |
, m_cursorOptions(other->m_cursorOptions) |
| 1338 |
, m_currentKey(other->m_currentKey) |
1340 |
, m_currentKey(other->m_currentKey) |
|
|
1341 |
, m_recordIdentifier(IDBRecordIdentifier::create()) |
| 1339 |
{ |
1342 |
{ |
| 1340 |
if (other->m_iterator) { |
1343 |
if (other->m_iterator) { |
| 1341 |
m_iterator = m_transaction->createIterator(); |
1344 |
m_iterator = m_transaction->createIterator(); |
|
Lines 1345-1350
IDBBackingStoreLevelDB::Cursor::Cursor(const IDBBackingStoreLevelDB::Cursor* oth
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec7
|
| 1345 |
ASSERT(m_iterator->isValid()); |
1348 |
ASSERT(m_iterator->isValid()); |
| 1346 |
} |
1349 |
} |
| 1347 |
} |
1350 |
} |
|
|
1351 |
|
| 1352 |
m_recordIdentifier->reset(other->m_recordIdentifier->encodedPrimaryKey(), other->m_recordIdentifier->version()); |
| 1348 |
} |
1353 |
} |
| 1349 |
|
1354 |
|
| 1350 |
bool IDBBackingStoreLevelDB::Cursor::firstSeek() |
1355 |
bool IDBBackingStoreLevelDB::Cursor::firstSeek() |
|
Lines 1505-1512
public:
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec8
|
| 1505 |
} |
1510 |
} |
| 1506 |
|
1511 |
|
| 1507 |
// IDBBackingStoreLevelDB::Cursor |
1512 |
// IDBBackingStoreLevelDB::Cursor |
| 1508 |
virtual PassRefPtr<SharedBuffer> value() const { ASSERT_NOT_REACHED(); return 0; } |
1513 |
virtual PassRefPtr<SharedBuffer> value() const OVERRIDE { ASSERT_NOT_REACHED(); return 0; } |
| 1509 |
virtual bool loadCurrentRow(); |
1514 |
virtual bool loadCurrentRow() OVERRIDE; |
| 1510 |
|
1515 |
|
| 1511 |
protected: |
1516 |
protected: |
| 1512 |
virtual Vector<char> encodeKey(const IDBKey &key) |
1517 |
virtual Vector<char> encodeKey(const IDBKey &key) |
|
Lines 1548-1554
bool ObjectStoreKeyCursorImpl::loadCurrentRow()
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec9
|
| 1548 |
} |
1553 |
} |
| 1549 |
|
1554 |
|
| 1550 |
// FIXME: This re-encodes what was just decoded; try and optimize. |
1555 |
// FIXME: This re-encodes what was just decoded; try and optimize. |
| 1551 |
m_recordIdentifier.reset(encodeIDBKey(*m_currentKey), version); |
1556 |
m_recordIdentifier->reset(encodeIDBKey(*m_currentKey), version); |
| 1552 |
|
1557 |
|
| 1553 |
return true; |
1558 |
return true; |
| 1554 |
} |
1559 |
} |
|
Lines 1566-1573
public:
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec10
|
| 1566 |
} |
1571 |
} |
| 1567 |
|
1572 |
|
| 1568 |
// IDBBackingStoreLevelDB::Cursor |
1573 |
// IDBBackingStoreLevelDB::Cursor |
| 1569 |
virtual PassRefPtr<SharedBuffer> value() const { return m_currentValue; } |
1574 |
virtual PassRefPtr<SharedBuffer> value() const OVERRIDE { return m_currentValue; } |
| 1570 |
virtual bool loadCurrentRow(); |
1575 |
virtual bool loadCurrentRow() OVERRIDE; |
| 1571 |
|
1576 |
|
| 1572 |
protected: |
1577 |
protected: |
| 1573 |
virtual Vector<char> encodeKey(const IDBKey &key) |
1578 |
virtual Vector<char> encodeKey(const IDBKey &key) |
|
Lines 1612-1618
bool ObjectStoreCursorImpl::loadCurrentRow()
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec11
|
| 1612 |
} |
1617 |
} |
| 1613 |
|
1618 |
|
| 1614 |
// FIXME: This re-encodes what was just decoded; try and optimize. |
1619 |
// FIXME: This re-encodes what was just decoded; try and optimize. |
| 1615 |
m_recordIdentifier.reset(encodeIDBKey(*m_currentKey), version); |
1620 |
m_recordIdentifier->reset(encodeIDBKey(*m_currentKey), version); |
| 1616 |
|
1621 |
|
| 1617 |
Vector<char> value; |
1622 |
Vector<char> value; |
| 1618 |
value.append(valuePosition, m_iterator->value().end() - valuePosition); |
1623 |
value.append(valuePosition, m_iterator->value().end() - valuePosition); |
|
Lines 1620-1626
bool ObjectStoreCursorImpl::loadCurrentRow()
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec12
|
| 1620 |
return true; |
1625 |
return true; |
| 1621 |
} |
1626 |
} |
| 1622 |
|
1627 |
|
| 1623 |
class IndexKeyCursorImpl : public IDBBackingStoreLevelDB::Cursor { |
1628 |
class IndexKeyCursorImpl FINAL : public IDBBackingStoreLevelDB::Cursor { |
| 1624 |
public: |
1629 |
public: |
| 1625 |
static PassRefPtr<IndexKeyCursorImpl> create(LevelDBTransaction* transaction, const IDBBackingStoreLevelDB::Cursor::CursorOptions& cursorOptions) |
1630 |
static PassRefPtr<IndexKeyCursorImpl> create(LevelDBTransaction* transaction, const IDBBackingStoreLevelDB::Cursor::CursorOptions& cursorOptions) |
| 1626 |
{ |
1631 |
{ |
|
Lines 1633-1642
public:
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec13
|
| 1633 |
} |
1638 |
} |
| 1634 |
|
1639 |
|
| 1635 |
// IDBBackingStoreLevelDB::Cursor |
1640 |
// IDBBackingStoreLevelDB::Cursor |
| 1636 |
virtual PassRefPtr<SharedBuffer> value() const { ASSERT_NOT_REACHED(); return 0; } |
1641 |
virtual PassRefPtr<SharedBuffer> value() const OVERRIDE { ASSERT_NOT_REACHED(); return 0; } |
| 1637 |
virtual PassRefPtr<IDBKey> primaryKey() const { return m_primaryKey; } |
1642 |
virtual PassRefPtr<IDBKey> primaryKey() const OVERRIDE { return m_primaryKey; } |
| 1638 |
virtual const IDBBackingStoreLevelDB::RecordIdentifier& recordIdentifier() const { ASSERT_NOT_REACHED(); return m_recordIdentifier; } |
1643 |
virtual const IDBRecordIdentifier& recordIdentifier() const OVERRIDE { ASSERT_NOT_REACHED(); return *(m_recordIdentifier.get()); } |
| 1639 |
virtual bool loadCurrentRow(); |
1644 |
virtual bool loadCurrentRow() OVERRIDE; |
| 1640 |
|
1645 |
|
| 1641 |
protected: |
1646 |
protected: |
| 1642 |
virtual Vector<char> encodeKey(const IDBKey &key) |
1647 |
virtual Vector<char> encodeKey(const IDBKey &key) |
|
Lines 1711-1717
bool IndexKeyCursorImpl::loadCurrentRow()
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec14
|
| 1711 |
return true; |
1716 |
return true; |
| 1712 |
} |
1717 |
} |
| 1713 |
|
1718 |
|
| 1714 |
class IndexCursorImpl : public IDBBackingStoreLevelDB::Cursor { |
1719 |
class IndexCursorImpl FINAL : public IDBBackingStoreLevelDB::Cursor { |
| 1715 |
public: |
1720 |
public: |
| 1716 |
static PassRefPtr<IndexCursorImpl> create(LevelDBTransaction* transaction, const IDBBackingStoreLevelDB::Cursor::CursorOptions& cursorOptions) |
1721 |
static PassRefPtr<IndexCursorImpl> create(LevelDBTransaction* transaction, const IDBBackingStoreLevelDB::Cursor::CursorOptions& cursorOptions) |
| 1717 |
{ |
1722 |
{ |
|
Lines 1724-1733
public:
a/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp_sec15
|
| 1724 |
} |
1729 |
} |
| 1725 |
|
1730 |
|
| 1726 |
// IDBBackingStoreLevelDB::Cursor |
1731 |
// IDBBackingStoreLevelDB::Cursor |
| 1727 |
virtual PassRefPtr<SharedBuffer> value() const { return m_currentValue; } |
1732 |
virtual PassRefPtr<SharedBuffer> value() const OVERRIDE { return m_currentValue; } |
| 1728 |
virtual PassRefPtr<IDBKey> primaryKey() const { return m_primaryKey; } |
1733 |
virtual PassRefPtr<IDBKey> primaryKey() const OVERRIDE { return m_primaryKey; } |
| 1729 |
virtual const IDBBackingStoreLevelDB::RecordIdentifier& recordIdentifier() const { ASSERT_NOT_REACHED(); return m_recordIdentifier; } |
1734 |
virtual const IDBRecordIdentifier& recordIdentifier() const OVERRIDE { ASSERT_NOT_REACHED(); return *(m_recordIdentifier.get()); } |
| 1730 |
bool loadCurrentRow(); |
1735 |
virtual bool loadCurrentRow() OVERRIDE; |
| 1731 |
|
1736 |
|
| 1732 |
protected: |
1737 |
protected: |
| 1733 |
virtual Vector<char> encodeKey(const IDBKey &key) |
1738 |
virtual Vector<char> encodeKey(const IDBKey &key) |